having problems with spaces in file/folder name with 'for' command
hi all i'm trying to use the 'for' command along with 'move' to help move all .rar files from one folder to another but some files have spaces and don't get moved as the spaces break the script
i've tried adding " to the folder path but that didn't work any ideas? this is what i have so far: Code:
for /F %%f in ("F:\old\*.rar") do move "%%f" "F:\new\" |
The /F option doesn't accept wildcards, and you shouldn't quote wildcards:
Code:
for %%f in (F:\old\*.rar) do move "%%f" "F:\new\" Code:
move F:\old\*.rar "F:\new" |
|
Quote:
|
:doh: ... dos !!! Man, I can't remember the last time I wrote a bat file.
Sorry for butting in ... :p |
ahhh syg00 ... showing your age again ...lol
OP - ntubski's solution looks good :) |
true but i need to do this via an f loop though
|
You can if you wish, but the point being made is that the 2 code snippets shown by ntubski do the same thing :)
|
You should try http://www.4dos.info/
I used to use it back in the day! We used to leave our doors unlocked, and it was sunny. |
Quote:
Code:
for %%f in ("F:\old\*.rar") do if %%~zf lss 680525824 move "%%f" "F:\new\" |
Well that would be the usual story of you now adding further detail which changes the question, but now you have a working solution?
|
Quote:
|
Hmm, works for me:
Code:
C:\>dir C:\temp\old |
Not having played with batch files for a while, much like syg00, I would point out that ntubski is using single % signs and has an @ in front of if.
Maybe these are the missing items? |
damn got it all working was the error of a random extra set of quotes lol
thanks all :) |
All times are GMT -5. The time now is 10:17 PM. |