burgemaster Posted March 23, 2011 Posted March 23, 2011 We have a script (below) that copies all the files from our Flip Video Cameras to a network share and then deletes the files from the camera..... BUT if there is a problem copying the files (i.e quota) then it still carries on and deletes the files. Could someone please suggest an ammendment to check that the files are copied before it deletes? Thanks in advance! @echo off MODE CON: COLS=75 LINES=20 COLOR 1F title Copying Files from Flip Camera echo Copying Files from Camera to O: Drive..... for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j-%%k-%%l for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i set tm=%tm::=-% set dtt=%dt%%tm% Set "sourcefolder=E:\DCIM\100VIDEO" Set "destinationfolder=O:\PE\Student Videos" For %%a in ("%sourcefolder%\*.*") Do If exist "%%a" ( xcopy /q /s /c /d /i /y "%%a" "%destinationfolder%\%dtt%-%%~na.*" ) COLOR CF PING 1.1.1.1 -n 1 -w 3400 >NUL COLOR AF echo Removing files from camera.... PING 1.1.1.1 -n 1 -w 2400 >NUL del /q E:\DCIM\100VIDEO\*.AVI CLS PING 1.1.1.1 -n 1 -w 2400 >NUL echo Files copied to O: Drive and removed from camera..... PING 1.1.1.1 -n 1 -w 2400 >NUL Echo Remove Camera and press any key pause
Arthur Posted March 23, 2011 Posted March 23, 2011 You could check XCopy's errorlevel and then skip the delete part of your script if it doesn't equal zero. IF %ERRORLEVEL% NEQ 0 GOTO abort [b]XCopy Error Levels[/b] 0 success 1 no files found to copy 2 aborted by ^C 4 initialization error (not enough memory or disk space, invalid drive, or syntax error) 5 disk write error 1
burgemaster Posted March 23, 2011 Author Posted March 23, 2011 IF %ERRORLEVEL% NEQ 0 GOTO abort added and working ! Thanks !!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now