Jump to content

XCOPY cmd question


ceez

Recommended Posts

hello fellow msfn'ers,

I am creating a script at work to backup the docs, favs, desktop, & outlook pst folder to their network user drive. I am using the xcopy command with an exclude file, yet the exclude.txt file is giving issues, it will not exclude files on my desktop but it DOES exclude the my documents. Below is a copy of my exclude.txt

"%USERPROFILE%\My Documents\".wmv

"%USERPROFILE%\My Documents\".wma

"%USERPROFILE%\My Documents\".mp3

"%USERPROFILE%\Desktop\".wmv

"%USERPROFILE%\Desktop\".wma

"%USERPROFILE%\Desktop\".mp3

"%USERPROFILE%\Desktop\".lnk

XCOPY "%USERPROFILE%\My Documents\*.*" "%homedrive%\%USERNAME%-BACKUP-%DATE:/=%\My Documents\" /e /y /c /exclude:c:\exclude.txt

XCOPY "%USERPROFILE%\Desktop\*.*" "%homedrive%\%USERNAME%-BACKUP-%DATE:/=%\Desktop\" /e /y /c /exclude:c:\exclude.txt

XCOPY "%USERPROFILE%\Favorites\*.*" "%homedrive%\%USERNAME%-BACKUP-%DATE:/=%\Favorites\" /e /y

XCOPY "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook\*.*" "%homedrive%\%USERNAME%-BACKUP-%DATE:/=%/Outlook\" /e /y

Can some script guru help me with this?

Thanks,

ceez :thumbup

Edited by ceez
Link to comment
Share on other sites


Ok I figured out the problem.

The exclude.txt file DOES NOT NEED ANY PATHS, just the file or folders that you want exluded, ie:

.wma

.wmv

.mp3

.lnk

or if you want to exclude folders:
\pics\

\aim\

\test\

Issue resolved if anyone ever needs to exclude files with xcopy!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...