xcopy log script

Mar 19, 2018
2
0
10
Hi Guys,

I have made a script that is a simple backup script that looks like the following:

@echo off

:: Prepare date/time stamp
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

:: Timestamp (yyyymmmdd-hhnnss)
set tm=%tm::=-%
set timest=%dt%%tm%

:: Directories
mkdir "F:\File\Backup\CC\%timest%"

:: Copy Files
xcopy /s /e /y "F:\File\Active" "F:\File\Backup\CC\"%timest%"
echo Done
goto End

So this will take my files from one place to the next making a new folder with the current date and time. Now I want to have a log file of that files have been copied. I know robocopy can do a log file with "/LOG+:" is this possible with a xcopy?

Please let me know :)
 

popatim

Titan
Moderator
Here's a simple addition that will give you the basics of what you asked for. You can modify the filename to change the destination path and filename if you wanted to create a date/time as part of the filename.

:: Copy Files
xcopy /s /e /y "F:\File\Active" "F:\File\Backup\CC\"%timest%"

:: Log Creation
Dir F:\File\Backup\CC\"%timest%" > filename.txt

echo Done
goto End