Copy shows errors

March 8, 2010 at 09:00:38
Specs: Windows XP
Hi all,

I wanted to run a batch file with alot of basic
copy formulas copying images numbers from 1
to 10 e.g.

copy "C:\myfolder\1.tif" "C:\myfolder\folder\"

but for some reason if the images aren't copied
over, i want the batch file to let me know
somehow, if all the errors would show up in a
txt file or something like that.

Could anyone help me with this please?

See More: Copy shows errors

Report •

March 8, 2010 at 10:26:29
copy bla new 2~>>error.txt

Helping others achieve escape felicity


Report •

March 8, 2010 at 10:32:23
I'm reading your question as : I want to catch all possible errors that could occur on command as per example:

copy "C:\myfolder\1.tif" "C:\myfolder\folder\"

What you can do is this:

set source_folder="C:\myfolder\"
set source_file=1.tif
set target="C:\myfolder\folder"

if NOT exist %source_folder%\%source_file% set error=source %source_folder%\%source_file% does not exist & goto error

if NOT exist %target%\ set error=target directory %target%\ does not exist & goto error

if exist %target%\%source_file% set error=target file %target%\%source_file% already exists & goto error

copy %source_folder%\%source_file% %target%
echo File %source_file% copied >> c:\succes.log
goto :OEF

echo %error% >> c:\error.log
goto :EOF

Report •

Related Solutions

Ask Question