directory - Create folders based on second column in text file and then move files into their folders accordingly -
i have thousands of files received cnc machine sorted. have index lists files , categories. column separated tab character. here example of content of index file:
111.maz aaa fgh 222.maz bbb iyu 333.eia cccdfew 444.maz aaawer bb bbba 555.eia aaa 123 666.m6m ddd234 777.pbd aaa ....... .....
thus, need following:
- create folders based on second column (successful), using excel separate column, batch create folder using following command:
for /f %d in (list.txt) md %d
- transfer files folders accordingly (?)
i'm not sure how second task. can point me in right direction?
after hundred times of running , failing, finally, have sorted of them respective folders @stephan , @josefz. tweaked code little bit create ones file exists.
for /f "tokens=1,*" %%g in (index.txt) ( if exist %%g ( md "%%~h" 2^>nul move "%%~g" "%%~h" ) )
have nice day!
no need excel. can parse index batch:
for /f "tokens=1,2 delims=<tab>" %%a in (index.txt) ( rem create folder, ignore "folder exists" error: echo md "%%b" 2>nul rem move file: echo move "%%a" "%%b" )
note: instead of <tab>
insert tabulator texteditor (notepad?)
remove echo
s, if output good.
Comments
Post a Comment