Click here to Skip to main content
15,883,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have a question. consider i am copying 100 images from one drive with same path to another drive.

copy /Y "d:\log\games\images\283.png" "c:\log\games\images\283.png" >> log.txt
copy /Y "d:\log\games\images\289.png" "c:\log\games\images\289.png" >> log.txt
copy /Y "d:\log\games\images\285.png" "c:\log\games\images\285.png" >> log.txt
copy /Y "d:\log\games\images\284.png" "c:\log\games\images\284.png" >> log.txt

this is just an example. i have thousands of images like this to move.

i just want the log to show me the path 'if image not found or any error
currently it is showing "The system cannot find the path specified."
i want it to display me which image it didn't copy or atleast the cmd it executed.

like if there is a failure on
copy /Y "d:\log\games\images\285.png" "c:\log\games\images\285.png" >> log.txt
i want it to echo me the command or line linked with it. is this possible with looping. or if you can suggest me a better way to copy.

Thanks in advance.
Posted

1 solution

Better way:
copy /Y "d:\log\games\images\*.png" "c:\log\games\images\" >> log.txt

It will copy all png from d: to c: with same names...


If you want to create the folder if it doesn't exist you'll have to delve into batch files[^] to run :)

Or use xcopy, I vaguely remember there is an option to create non-existing folders during copying...


If this helps please take time to accept the solution. Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900