1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Xcopy Batch File

Discussion in 'DOS/Other' started by DigitalDawn, Jan 14, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. DigitalDawn

    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.
     
  2. foxidrive

    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.
     
  3. DigitalDawn

    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?
     
  4. Squashman

    Squashman Trusted Advisor

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

    /H Copies hidden and system files also.
     
  5. DigitalDawn

    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.
     
  6. Sponsor

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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1085219

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice