Xcopy makes a hidden directory

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
 
M

Mike Brearley

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.
 
G

Guest

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.
 
M

Mike Brearley

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top