Xcopy Batch File

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

DigitalDawn

Thread Starter
Joined
Dec 31, 1969
Messages
3
Hi,

I created a batch file to perform a daily backup of changed files from my hard disk to a large (Fat32) flash drive using xcopy. I've used the xcopy command successfully with Windows XP for years. But after switching to Windows 7 I've been having difficulty getting the batch file to work correctly with some directories.

The problem is that it doesn't drill down into my users/username/appdata/roaming/Microsoft directories. It does work correctly in most other directories (such as documents), but it doesn't copy sub directories in certain places such as users, and program data.

Here it is:

cd\
xcopy c:\*.* f:\ /s /m /y /c /EXCLUDE:C:\exclude.txt
cd\

The exclude part works fine. I've been excluding the C:\windows folder and C:\program files folders.

I've tried using the /n /r and /i switches with no luck. I close down all programs before running the batch file. I did try to use Rich Copy but I couldn't figure that program out to save my life :)

Am I missing something, or is there no way to get xcopy to work properly with Win7?

Thanks.
 

foxidrive

Banned
Joined
Oct 20, 2012
Messages
793
xcopy cannot copy open/locked files and an admin doesn't own all the file system in Windows now.

If you want to make a backup then you need something that uses volume shadow copy, like Macrium Reflect (there's a free version) or Acronis, or XXclone etc.
 

DigitalDawn

Thread Starter
Joined
Dec 31, 1969
Messages
3
Thanks for the info.

I'm not sure that a clone or image program is what I'm looking for. I just want a program that copies changed files to a flash drive and then resets the archive bit on the source file. I would like to have the files be readable on any PC, so compression or proprietary formats wouldn't work.

Are there any other programs you could recommend?
 

Squashman

Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
Appdata is a hidden folder.

/H Copies hidden and system files also.
 

DigitalDawn

Thread Starter
Joined
Dec 31, 1969
Messages
3
Great catch! That did the trick!

Now I wish I could figure out how to clear the archive bits in some of those directories. Windows file explorer gives me an "access denied" when I try to reset the archive bit on certain files -- even when I run it in admin mode.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top