Solved

using xcopy and \exclude

Posted on 2004-09-19
3
3,611 Views
Last Modified: 2009-07-29
well i thought this was working but i just saw a bunch of files from 'system volume information' scrolling across my screen as they copied so i guess not.  i saw a thread that seems to imply i need to use 8.3 style folder names but i saw a reference on the ms site saying it will use an absolute reference for a folder.  altho i would like to use relative names so this will work on any drive.

i have a batch file that is copying my c: drive to another drive for temporary backup.  i have created an exclude list of things to NOT copy.  it seems the exclude is having problems.  any ideas on what i am doing wrong?  thanks.  jim

*************************
bakc is in c:\bin   so is xf.txt

bakc.bat  -->>  xcopy c:\* n:\NewFolderc\   /e /s /y /d /c /i /h /exclude:xf.txt

xf.txt (below)
zgpt*
\recycler
\windows
\winxp
\temp
"\system volume information"
"system volume information"
pagefile.sys
hyb*.sys
\wutemp\
\i386
0
Comment
Question by:jsturtz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Expert Comment

by:mrwad99
ID: 12096756
A few points I noticed:

You have the switches: /e /s

  /S           Copies directories and subdirectories except empty ones.
  /E           Copies directories and subdirectories, including empty ones.

Now, one or the other is best here, but not both :)

Also /D

  /D:m-d-y     Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.

I don't think you need this really.

>> "\system volume information"

Should be

"\system volume information\"

("/EXCLUDE:file1[+file2][+file3]...
               Specifies a list of files containing strings.  When any of the
               strings match any part of the absolute path of the file to be
               copied, that file will be excluded from being copied.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively."

Those changes should bring some improvement.

HTT
0
 
LVL 3

Accepted Solution

by:
cupawntae earned 250 total points
ID: 12097847
You have two main problems here:

1 - the strings are not wildcard patterns so hib*.sys is not going to work - you'll need to mention each file by name for this kind of pattern. For the simpler "something beginning with xxxx" pattern, just leave out the '*' - take zgpt* for example: the line should simply be:

zgpt

(no '*')

2 (and this is the important one) - you don't need (and shouldn't use) quotes - so "\system volume information" should be:

\System Volume Information

(no quotes). You can put in the second backslash as suggested above but all this will do is make sure it doesn't accidentally exclude files called something like "\mydir\system volume informations" - this won't solve your problem.

Basically for each exclude to work, the string has to be part of the full filename, verbatim...

Hope that helps,

CupawnTae
0
 
LVL 1

Author Comment

by:jsturtz
ID: 12125965
mrwad99
i tried using "\system volume information\" twice, as opposed to CupawnTae's suggestion of \System Volume Information.  the quotes marks interfere with the exclusion.

i again tried the /d option and confirmed my reasoning for it.  w/o the /d the entire directory is copied over everytime one uses xcopy, with the /d then only changed stuff since last time get copied.  that is the behavior i am looking for.

thanks to both of you for your replies.

give the points to CupawnTae
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.net and sql server 4 67
Is online banking safe? 11 127
Ruby or Python 7 133
XSLT to pick out a particular element and then pick out all following siblings 4 20
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question