Moves files found in CSV using batch file

If you have a CSV file (say, ‘filename.csv’) which has the list of the files location in any column(say, 2) and want to move those files in to folder (say, ‘DestinationFolder’) then you can achieve it by creating a batch file (say, ‘MoveFile.bat’) to do it.

Using any text editor type following DOS commands:

rem Moves files into Destination Folder
for /f “tokens=2 delims=,” %%a in (D:\filename.csv) do (
move %%~a  D:\DestinationFolder
)

When you run the batch file

D:\>MoveFile.bat

Then it will iterate through the file location found in CSV file and move the file(s) to destination folder.

If you want to copy the file then use copy command.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Hit Counter provided by Curio cabinets