开发者

move files with spaces in file name using batch script

开发者 https://www.devze.com 2023-04-10 10:55 出处:网络
I have next code and it work开发者_如何学Pythons perfectly as far as there are no spaces in file names.

I have next code and it work开发者_如何学Pythons perfectly as far as there are no spaces in file names.

FOR /F "usebackq tokens=1" %%n IN (`dir D:\Skripte\radno\temp /b`) DO @FOR /F "usebackq tokens=2,3,4 delims=. " %%d IN (`date /t`) DO @move D:\App\STE\_Isporuka\Doc\%%n \\gds21-bdc01\STE\Arhiva\Novo\Doc\%%f%%e%%d-%%n

I need same functionality for files with spaces in file names.

Thanks, Tiho


You will need to set a blank delimiter to the first for loop and quote the filenames in the second loop:

FOR /F "usebackq tokens=1 delims=" %%n IN (`dir D:\Skripte\radno\temp /b`) DO @FOR /F "usebackq tokens=2,3,4 delims=. " %%d IN (`date /t`) DO @move "D:\App\STE\_Isporuka\Doc\%%n" "\\gds21-bdc01\STE\Arhiva\Novo\Doc\%%f%%e%%d-%%n"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号