XCOPY /exclude file not read

G

Guest

I used the command:

xcopy /d /y /s /i C:\"Documents and Settings"\hmm\"Application
Data"\Microsoft\Templates G:\Users\hmm\Backups\Templates
/exclude:ExcludeBackup.txt

to back up all my templates to a network drive. I wanted to exclude certain
files(that refer to backup and temp files) from being copied. I included
these strings(.xlk, .tmp, and ~), each on a separate line, in file
ExcludeBackup.txt, placed in the source directory (C:\...\Templates).

The response from the command prompt was:

Can't read file: ExcludeBackup.txt

What am I doing wrong? How do I get /exclude to work?
 
C

cquirke (MVP Windows shell/user)

On Thu, 5 Jul 2007 01:36:00 -0700, hmm
I used the command:
xcopy /d /y /s /i C:\"Documents and Settings"\hmm\"Application
Data"\Microsoft\Templates G:\Users\hmm\Backups\Templates
/exclude:ExcludeBackup.txt
to back up all my templates to a network drive.
The response from the command prompt was:
Can't read file: ExcludeBackup.txt
What am I doing wrong? How do I get /exclude to work?

You may need to specify the full filespec for ExcludeBackup.txt

ExcludeBackup.txt = (implicitly) .\ExcludeBackup.txt where "." =
"current directory", which may not be current for the program at the
time it is running. So try C:\Full\Path\To\ExcludeBackup.txt and if
that works, you can experiment with %~dp0 syntax etc.



--------------- ----- ---- --- -- - - -
Who is General Failure and
why is he reading my disk?
 
C

cquirke (MVP Windows shell/user)

Thanks for your help, cquirke. However, I still get the same error message.

Bummer! OK, next steps: Try an 8.3-compliant name, and re-check the
syntax for the /exclude: option (e.g. spaces and delimiters, whether
it should go before or after the source and destination, etc.)

Context:
-------------------- ----- ---- --- -- - - - -
Tip Of The Day:
To disable the 'Tip of the Day' feature...
 
G

Guest

I have replaced spaces with underscores (there were no actual underscores
used).

C:\>xcopy_/d_/y_/s_/i_C:\"Documents_and_Settings"\hmm\"Application_Data"\Microsoft\Templates\_G:\Users\hmm\Backups\Templates\_/exclude:C:\"Documents_and_Settings"\hmm\"Application_Data"\Microsoft\Templates\ExclBkUp.txt

Can't_read_file:_C:\"Documents_and_Settings"\hmm\"Application_Data"\Microsoft\Templates\ExclBkUp.txt

0_File(s)_copied
 
C

cquirke (MVP Windows shell/user)

I have replaced spaces with underscores (there were no actual underscores
used).

OK. The "quote marks" may be an issue, at first glance; often a
problem when constructing a file spec from variables and literals...

Set Base="C:\Program Files"
Copy %Base%\Tools\AdAware\*.* .

"C:\Program Files"\AdAware\*.* may be rejected as a filespec

Breaking at some of the space parameter delimiters, we get...
C:\>xcopy_/d_/y_/s_/i_
C:\"Documents_and_Settings"\hmm\"Application_Data"\Microsoft\Templates\

The above looks broken and I expect it would fail; try...

"C:\Documents_and_Settings\hmm\Application_Data\Microsoft\Templates\"

....or...

"C:\Documents_and_Settings\hmm\Application_Data\Microsoft\Templates"
G:\Users\hmm\Backups\Templates\

That's OK
/exclude:C:\"Documents_and_Settings"\hmm\"Application_Data"\Microsoft\Templates\ExclBkUp.txt

May be broken again; try...

/exclude:"C:\Documents_and_Settings\hmm\Application_Data\Microsoft\Templates\ExclBkUp.txt"

....or...

/exclude:_"C:\Documents_and_Settings\hmm\Application_Data\Microsoft\Templates\ExclBkUp.txt"

....or...

/exclude:C:\Docume~1\hmm\Applic~1\Micros~1\Templa~1\ExclBkUp.txt

....or...

/exclude:_C:\Docume~1\hmm\Applic~1\Micros~1\Templa~1\ExclBkUp.txt

....where I've used "_" for space, as you had.

--------------- ----- ---- --- -- - - -
Error Messages Are Your Friends
 
G

Guest

Okay, let's keep trying.

First, the xcopy command works fine without the /exclude extension. So no
problem with anything in the command up to there.


When I include a space between /exclude and C:, I get the message "Invalid
number of parameters." Without the space, using the 8.3 shortened folder
names, I get "Invalid path 0 File(s) copied"; using the standard folder
names (enclosing the multi-word folders in quotes), as before I get the
"Can't read file... 0 files copied" message.
 
C

cquirke (MVP Windows shell/user)

On Mon, 9 Jul 2007 06:04:00 -0700, hmm
Okay, let's keep trying.
First, the xcopy command works fine without the /exclude extension. So no
problem with anything in the command up to there.

OK, that's interesting, as I'd have expected that syntax to break it.

Re-ordering quotage...
...I get the message "Invalid number of parameters."

That clarifies that, good...
...I get the "Can't read file... 0 files copied" message.

...I get "Invalid path 0 File(s) copied"; using the standard folder

Strange, yes. Have you tried a really simple filespec for the
exclusion file, to verify the syntax works? Regarding the 8.3 test,
have you verified the ~n index values are correct (i.e. may not always
be "1") and that the file system doesn't have 8.3 disabled?

It may be that while C:"\Program Files"\hmm\"other stuff" syntax works
for the source and destination values, it fails for the option
parameters. CLI syntax is not always consistent in these things, e.g.
consider how sometimes space separators aren't needed e.g. Dir/W


--------------- ----- ---- --- -- - - -
Tech Support: The guys who follow the
'Parade of New Products' with a shovel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top