Hi all,
I'm wondering is it possible to do a dos move using an input file.. I've 400+ files to move from one dir to another and thought it might be a bit cleaner if I could use a txt file as the input but not sure if thats possible..
Any help would be appreciated..
Thanks...
Move command question
Moderator: DosItHelp
Re: Move command question
How does your list look like? Only the source file names line by line?
Regards
aGerman
Regards
aGerman
Re: Move command question
Hi,
At the minute it's just in a txt file in the following format:
About.bmp
ACTDATA.CSV
APPTRACK.EXE
ARA_FIHI.CSV
and so on...
At the minute it's just in a txt file in the following format:
About.bmp
ACTDATA.CSV
APPTRACK.EXE
ARA_FIHI.CSV
and so on...
Re: Move command question
Untested:
Regards
aGerman
Code: Select all
@echo off &setlocal
set "sourceFolder=c:\path\to\your\files"
set "destinationFolder=c:\path\to\move\the\files"
set "listFile=myFileList.txt"
for /f "usebackq delims=" %%a in ("%listFile%") do (
move "%sourceFolder%\%%~a" "%destinationFolder%\"
)
Regards
aGerman
Re: Move command question
Just did a quick test and it works great..
Thanks a mil for your help..
EDIT**
Actually, would you mind explaining what the below is doing?
Thanks a mil for your help..
EDIT**
Actually, would you mind explaining what the below is doing?
Code: Select all
usebackq delims=" %%a in
Re: Move command question
Of ourse.
The FOR /F loop iterates the list file line by line.
I used USEBACKQ for being able to enclose the file name in double quotes (that was done because I didn't know whether the file name of your list contains spaces).
Normally the line read from the list would be delimited in tokens by spaces and tabs. For that reason I used DELIMS= to disable the default delimiters and make sure you get the entire line into variable %%a.
Have a look at the command index to learn more.
Regards
aGerman
The FOR /F loop iterates the list file line by line.
I used USEBACKQ for being able to enclose the file name in double quotes (that was done because I didn't know whether the file name of your list contains spaces).
Normally the line read from the list would be delimited in tokens by spaces and tabs. For that reason I used DELIMS= to disable the default delimiters and make sure you get the entire line into variable %%a.
Have a look at the command index to learn more.
Regards
aGerman
Re: Move command question
Cool, thanks again.. I'll have a read up on the command index now..
-
- Posts: 6
- Joined: 01 Jul 2011 16:38
Re: Move command question
ED209 wrote:!?!command index!?!