1
0
I have a small batch file that uses robocopy to backup a folder. The intended action is for it to copy C:/users/public/ into D:/Backups/YYYY-MM-DDTHHMM/
At present, it copies the files into a folder, however the folder name appears in Windows Explorer as 'Public' instead of the requested file name. Stranger still, if I dir the folder from cmd (or check the security tab of it's properties) it appears as the name I desire!
Batch file:
@ECHO OFF
for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
set today=%MyDate:~0,4%-%MyDate:~4,2%-%MyDate:~6,2%T%MyDate:~8,2%%MyDate:~10,2%
robocopy C:/users/Public D:/Backups/%today%
I have searched superuser and found the similar question http://superuser.com/questions/567331/robocopy-mir-changes-destination-folder-name-how-to-prevent-that , but I hope my description is clear enough to lead to a more useful solution.
– Garth Oates – 2014-04-22T11:05:09.203Found the solution. Because I was copying the windows directory Public; the desktop.ini file contained within it was changing the apparent folder name.
Changing the robocopy line to:
Excludes the windows appearance file and completes the job perfectly. I can't answer my own question for 8 hours but I'll add the answer then. – Garth Oates – 2014-04-22T12:36:32.697