Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mimicking an XCOPY DOS command
Message
De
14/02/2005 11:33:27
 
 
À
14/02/2005 10:37:13
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows 2000 SP4
Divers
Thread ID:
00986647
Message ID:
00986673
Vues:
18
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform