Computing.Net > Forums > Programming > Batch copy files, csv specific

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch copy files, csv specific

Reply to Message Icon

Name: Emsi
Date: January 13, 2009 at 08:30:17 Pacific
OS: Windows Vista
CPU/Ram: 3 GHz, 2 GB
Product: Medion / N/A
Subcategory: Batch
Comment:

Hi,

I have a csv file that looks like this:

"Path","Hash","othercolumns"
...

I'd like to write a batch file to execute the following copy command with each line specified in the CSV:

copy Path Target\Hash.Extension

Path is the first column of the CSV that contains the full file path including extension. Hash is the second column in CSV and should be the new filename.

Is that possible with a batch file or should I better to with a small self made program?


Regards,

Emsi



Sponsored Link
Ads by Google

Response Number 1
Name: reno
Date: January 13, 2009 at 09:52:11 Pacific
Reply:

for /f "tokens=1,2* delims=," %a in (csv) do @echo copy %a "%~fa\%~b%~xa"

type in command prompt, remove echo when the code suit you.


0

Response Number 2
Name: Emsi
Date: January 13, 2009 at 10:54:37 Pacific
Reply:

Thanks a lot! Powerful batch. :)


Regards,

Emsi


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


compare files Quser using .bat



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch copy files, csv specific

Batch copy files, csv specific columns www.computing.net/answers/programming/batch-copy-files-csv-specific-columns/19584.html

Batch - Copy Files using .txt List www.computing.net/answers/programming/batch-copy-files-using-txt-list/18010.html

Batch copy files on txt file incl. subdir. www.computing.net/answers/programming/batch-copy-files-on-txt-file-incl-subdir/20053.html