# Xcopy Batch File



## DigitalDawn (Jan 1, 1970)

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 (Oct 20, 2012)

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 (Jan 1, 1970)

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 (Apr 4, 2003)

Appdata is a hidden folder.

/H Copies hidden and system files also.


----------



## DigitalDawn (Jan 1, 1970)

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.


----------

