You are not logged in.
Some time ago I asked for help to create a bat that I were going to copy the mp3 from a list (this is the link to the discussion http://ss64.org/viewtopic.php?id=1298&p=1)
I was helped by many people and, in the end, I had used. the .bat created by bluesxman.
Only now I realized that it does not work with accented characters (such as "is" or "ù")
Can someone correct the bat? Thank you!
This is the bat:
@echo off
mode con codepage select=1252
set root=F:\ITA\
set list=E:\list ITA.txt
set another_folder=F:\Playlist ITA
set "all_files=%temp%\%~n0.all"
REM create a list of all mp3 files at source
echo:Scanning all files...
type nul > "%all_files%"
for /f "usebackq tokens=*" %%a in (`dir /a:-d /b /s "%root%\*.mp3"`) do echo:"%%~a"^|"|%%~na|" >> "%all_files%"
REM reprocess the search term list file into a format I can use
type nul > "%list%.fixed"
for /f "usebackq tokens=*" %%a in ("%list%") do (
set /p "out=|%%a|" <nul & echo:
set /p "out=|[0-9][0-9] - %%a|" <nul & echo:
) >> "%list%.fixed"
REM for every item in the search term list, filter matching lines from the list of all files
REM and copy the file to the target (I'm assuming you want a flat directory structure here)
echo:Filtering required files...
for /f "usebackq delims=| tokens=1*" %%a in (`type "%all_files%" ^| findstr /r /i /g:"%list%.fixed"`) do (
echo:"%%~a"
mkdir "%another_folder%%%~pa" 2>nul
copy /y "%%~a" "%another_folder%%%~pa"
)
pause
or, if is to hard, if there is an utility that can search files from a txt list
Thanks!
Last edited by Lauraq (27 Mar 2014 03:34)
Offline
findstr and find will both search for text in a file.
findrepl.bat is a grep-like tool that has a good feature set - download from: https://www.dropbox.com/s/rfdldmcb6vwi9xc/findrepl.bat
Place `findrepl.bat` in the same folder as the text file or on the path.
Someone else with experience will comment on the non-latin characters, as they can be problematic.
Offline
I did not understand anything of what I should do with the file that you have posted
I hope and believe that there is someone who has a simple solution becouse I m not expert
Last edited by Lauraq (27 Mar 2014 09:25)
Offline
People reading your question need details about what you plan to do before they can provide detailed code.
Offline
sorry but what details? I linked the thread that I had opened and the question is always the same, a bat that copy mp3 from a txt list. The .bat that I posted works perfectly except for accented characters that are not copied
Offline
You also asked to search a file and I posted info on three utilities that will do that.
Good luck.
Offline
Wow that was a while ago; glad my script was helpful. I don't have too much experience with non-Latin character sets, hopefully one of our more worldly contributors can offer a robust solution.
For the moment, you could try working around the issue by replacing non-Latin characters in your search terms text file with a ".", such that this:
this is jùst an example
becomes:
this is j.st an example
NB -- The dot character will match any character in that position, so with shorter search terms there is a small chance you will match more files than you intended.
Last edited by bluesxman (27 Mar 2014 11:21)
cmd | *sh | ruby | chef
Offline
I am happy to resent and hate you for the ease with which you can find solutions ^_^
Your idea works great, I get some duplicates but it is already a huge improvement! Then if anyone knows how to permanently solve the problem, I'm here waiting
Offline
cmd | *sh | ruby | chef
Offline