|I want to move files according to folder names.|
1.Some folder names have been written in b2.txt.In my b2.txt,every line contains one or two or three words ,connected by space or "-".Like this:
fibre reinforced plastic
2.My files is in "E:\JP-XIN\".
3.In E disk,there must existed one(only one) folder name containing one line in b2.txt.
My question is how to set exactly every line in b2.txt as variable.
In follow code,"%%k" is file name gotten by searching,"%%l" is path to the folder gotten by searching.The code worked not accurately.
for /f "delims=" %%a in (b2.txt) do (
for /f "delims=" %%k in ('dir /s/b/a-d E:\JP-XIN\*.pdf E:\JP-XIN\*.txt ^| findstr /i /c:"!VAR!"') do (
for /f "delims=" %%l in ('dir /s/b/a:d-h E:\ ^| findstr /i /c:"!VAR!"') do (
if not "%%l"=="" move "%%k" "%%~fsl"