Click here to Skip to main content
13,902,146 members
Rate this:
Please Sign up or sign in to vote.

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.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190306.1 | Last Updated 20 Nov 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100