Xcopy makes a hidden directory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to backup files as a scheduled task using a batch file. I am not
using the /h switch with Xcopy, and it is not copying system files, but the
directory it creates is hidden, hiding everything below it (the entire
backup). This happens when I Xcopy the root directory of a partition (e:\),
but not a subdirectory (e:\p). Please help. Batch file below:

set backdate=%date:~10,4%-%date:~4,2%-%date:~7,2%
xcopy e:\p\letters z:\%backdate% /e/y/i/c
 
Simply add in the following line at the end of the batch:

attrib -s -h -r z:\%backdate%

The -r may not be needed, but it doesn't hurt anything either.
 
Thank you very much. Worked! Out of curiosity, do you know why my problem
happened in the first place? If I hadn't tried to backup the whole drive
(previously I only used single directories to test the batch file) I never
would have troubleshot this. I noticed that my "empty" partition was 60gigs
used up.
 
I don't know the exact reason it happens, my guess would be that when the
system files from the root of the drive are being copied into the root of
the backup folder, Windows (for whatever reason) marks the folder as system
and hidden.
 
Back
Top