Folder changes to hidden during backup

D

Don Culp

As a backup method, I use the following to copy all files from drive F: to a
backup folder on H:

xcopy f: H:\Backup /s /e /v /d /y /c

where
/s = subdirectories
/e = empty directories
/v = verify
/d = only newer files
/y = overwrite without confirmation
/c = continue on error

The /c is required because xcopy would otherwise abort when trying to copy
two hidden folders on F:
Recycler and "System Volume Information".

xcopy works fine. However, shortly after xcopy starts, the Backup folder
changes to a hidden folder. If I explore this folder I find that the text of
the Hidden option is dimmed so the Hidden option apparently cannot be
changed. I have tried changing Backup to a normal folder from a cmd window:

attrib -h Backup

but receive the response:

Not resetting system file - H:\Backup

How can I either prevent Backup from becoming a hidden folder or else later
change it back to a normal folder?

(Note: I can see Backup in Windows Explorer since I have set "Tools\Folder
options\View\Show hidden files and folders". This is not the issue. What I
need to do is have Backup as a normal folder.)

Windows XP Pro, SP2

Thanks,
Don Culp
 
P

Pegasus \(MVP\)

Don Culp said:
As a backup method, I use the following to copy all files from drive F: to
a backup folder on H:

xcopy f: H:\Backup /s /e /v /d /y /c

where
/s = subdirectories
/e = empty directories
/v = verify
/d = only newer files
/y = overwrite without confirmation
/c = continue on error

The /c is required because xcopy would otherwise abort when trying to copy
two hidden folders on F:
Recycler and "System Volume Information".

xcopy works fine. However, shortly after xcopy starts, the Backup folder
changes to a hidden folder. If I explore this folder I find that the text
of the Hidden option is dimmed so the Hidden option apparently cannot be
changed. I have tried changing Backup to a normal folder from a cmd
window:

attrib -h Backup

but receive the response:

Not resetting system file - H:\Backup

How can I either prevent Backup from becoming a hidden folder or else
later change it back to a normal folder?

(Note: I can see Backup in Windows Explorer since I have set "Tools\Folder
options\View\Show hidden files and folders". This is not the issue. What I
need to do is have Backup as a normal folder.)

Windows XP Pro, SP2

Thanks,
Don Culp

A few comments might help you resolve the various issues:
- The command "xcopy f: H:\Backup /s /e /v /d /y /c" is not as robust as it
should be. I recommend you add a backslash in order to fully specify the
source folder: "xcopy f:\ H:\Backup /s /e /v /d /y /c".
- The "/v" switch probably doesn't do what you expect it to. It "verifies"
that the target information can be read. However, it does NOT compare the
source with the target file.
- Since the response to the command "attrib -h Backup" is "Not resetting
system file - H:\Backup", you should take appropriate action and change the
command to "attrib -h -s Backup" in order to knock out the System attribute.

Post again if this does not resolve your problem.
 
D

Don Culp

"attrib -h -s Backup" unhides Backup if it is run directly from a cmd
window. However, xcopy is actually within a batch file Bac_all.bat that is
run daily by the Task Scheduler. If I put "attrib -h -s Backup" after xcopy
in Bac_all.bat, then it does not change the hidden status of Backup.

Thanks,
Don Culp
 
P

Pegasus \(MVP\)

It is a commonly held misconception that commands typed at the Command
Prompt behave differently than those included in a batch file. This is
simply not true. There are some differences but they relate to loop
variables. To see it for yourself, modify your batch file like so:
@echo off
echo %date% %time% %UserName% >> c:\test.txt
echo Step1 & attrib h:\backup 1>>c:\test.txt 2>>&1
xcopy f:\ H:\Backup /s /e /v /d /y /c 1>>c:\test.txt 2>>&1
echo Step 2 & attrib h:\backup 1>>c:\test.txt 2>>&1
echo Step 3 & attrib h:\backup -h -s 1>>c:\test.txt 2>>&1
echo Step 4 & attrib h:\backup 1>>c:\test.txt 2>>&1
echo. >> c:\test.txt

And here is what the batch file does:
1. It creates a date stamp in the log file c:\test.txt.
2. It records the attributes of h:\backup.
3. It performs your backup action.
4. It records the attributes of h:\backup.
5. It resets the system & hidden attribute of h:\backup.
6. It records the attributes of h:\backup.

Now examine the log file carefully. Do you stand by your claim that "it does
not change the hidden status of Backup"? It goes without saying that you
must have sufficient access rights to modify the folder attributes.
 
D

Don Culp

I found the problem. In Bac_all.bat I called another batch file (Update.bat)
between xcopy and attrib:

xcopy f:\ H:\Backup /s /e /v /d /y /c
Update.bat
attrib h:\backup -h -s

Hence, attrib never executed. When I changed the second line to "call
Update.bat" everything ran OK.

Thanks again.
 
P

Pegasus \(MVP\)

Thanks for the feeback. The case demonstrates that you should post all
relevant details, not just a small fragment . . .
 

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