Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mimicking an XCOPY DOS command
Message
From
14/02/2005 11:33:27
 
 
To
14/02/2005 10:37:13
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows 2000 SP4
Miscellaneous
Thread ID:
00986647
Message ID:
00986673
Views:
19
>The problem with doing this now is there is no way to check to see if it worked correctly

Actually, there is. You can check the errorlevel to see if the xcopy succeeded. I have used the below code in a .cmd batch file to write the date and time of each successful or failed copy to a log file.

It uses UNC pathing, but pathing by drive letter works as well.
set dest=\\machinename\destinationshare
xcopy \\machinename\sourceshare\*.* %dest% /s /d /y

if errorlevel 1 goto failure

echo.>> %dest%\copylog.txt
echo Date and time of successful backup >>%dest%\copylog.txt
echo.|date|find "current">>%dest%\copylog.txt
echo.|time|find "current">>%dest%\copylog.txt   

GOTO END

:failure
echo.>> %dest%\copylog.txt
echo Date and time of failed backup >>%dest%\copylog.txt
echo.|date|find "current">>%dest%\copylog.txt
echo.|time|find "current">>%dest%\copylog.txt  

:END 
Jim Saunders
Microsoft
This posting is provided “AS IS”, with no warranties, and confers no rights.
Previous
Reply
Map
View

Click here to load this message in the networking platform