XCOPY /exclude file not read

Posted: 07-05-2007, 09:36 AM
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?
Reply With Quote

Responses to "XCOPY /exclude file not read"

cquirke (MVP Windows shell/user)
Guest
Posts: n/a
 
Re: XCOPY /exclude file not read
Posted: 07-07-2007, 04:45 PM
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?
>--------------- ----- ---- --- -- - - -
Reply With Quote
hmm
Guest
Posts: n/a
 
Re: XCOPY /exclude file not read
Posted: 07-08-2007, 07:50 AM
Thanks for your help, cquirke. However, I still get the same error message.

"cquirke (MVP Windows shell/user)" wrote:
> 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?
> >--------------- ----- ---- --- -- - - -
>
Reply With Quote
cquirke (MVP Windows shell/user)
Guest
Posts: n/a
 
Re: XCOPY /exclude file not read
Posted: 07-08-2007, 01:35 PM
On Sat, 7 Jul 2007 23:50:00 -0700, hmm wrote:
>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:
>"cquirke (MVP Windows shell/user)" wrote:
>> On Thu, 5 Jul 2007 01:36:00 -0700, hmm
>> >xcopy /d /y /s /i C:\"Documents and Settings"\hmm\"Application
>> >Data"\Microsoft\Templates G:\Users\hmm\Backups\Templates
>> >/exclude:ExcludeBackup.txt
>> >The response from the command prompt was:
>> >Can't read file: ExcludeBackup.txt
>> 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.

>-------------------- ----- ---- --- -- - - - -
Tip Of The Day:
To disable the 'Tip of the Day' feature...
>-------------------- ----- ---- --- -- - - - -
Reply With Quote
hmm
Guest
Posts: n/a
 
Re: XCOPY /exclude file not read
Posted: 07-08-2007, 02:22 PM
I have replaced spaces with underscores (there were no actual underscores
used).

C:\>xcopy_/d_/y_/s_/i_C:\"Documents_and_Settings"\hmm\"Application_Dat a"\Microsoft\Templates\_G:\Users\hmm\Backups\Templ ates\_/exclude:C:\"Documents_and_Settings"\hmm\"Applicati on_Data"\Microsoft\Templates\ExclBkUp.txt

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

0_File(s)_copied





"cquirke (MVP Windows shell/user)" wrote:
> On Sat, 7 Jul 2007 23:50:00 -0700, hmm wrote:
>
> >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:
>
> >"cquirke (MVP Windows shell/user)" wrote:
> >> On Thu, 5 Jul 2007 01:36:00 -0700, hmm
>
> >> >xcopy /d /y /s /i C:\"Documents and Settings"\hmm\"Application
> >> >Data"\Microsoft\Templates G:\Users\hmm\Backups\Templates
> >> >/exclude:ExcludeBackup.txt
>
> >> >The response from the command prompt was:
> >> >Can't read file: ExcludeBackup.txt
>
> >> 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.
>
>
>
> >-------------------- ----- ---- --- -- - - - -
> Tip Of The Day:
> To disable the 'Tip of the Day' feature...
> >-------------------- ----- ---- --- -- - - - -
>
Reply With Quote
cquirke (MVP Windows shell/user)
Guest
Posts: n/a
 
Re: XCOPY /exclude file not read
Posted: 07-08-2007, 10:19 PM
On Sun, 8 Jul 2007 06:22:00 -0700, hmm <hmm@discussions.microsoft.com>
>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\Mi crosoft\Templates\"

....or...

"C:\Documents_and_Settings\hmm\Application_Data\Mi crosoft\Templates"
>G:\Users\hmm\Backups\Templates\
That's OK
> /exclude:C:\"Documents_and_Settings"\hmm\"Applicati on_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\Applicatio n_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
>--------------- ----- ---- --- -- - - -
Reply With Quote
hmm
Guest
Posts: n/a
 
Re: XCOPY /exclude file not read
Posted: 07-09-2007, 02:04 PM
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.

"cquirke (MVP Windows shell/user)" wrote:
> On Sun, 8 Jul 2007 06:22:00 -0700, hmm <hmm@discussions.microsoft.com>
>
> >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\Mi crosoft\Templates\"
>
> ....or...
>
> "C:\Documents_and_Settings\hmm\Application_Data\Mi crosoft\Templates"
>
> >G:\Users\hmm\Backups\Templates\
>
> That's OK
>
> > /exclude:C:\"Documents_and_Settings"\hmm\"Applicati on_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\Applicatio n_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
> >--------------- ----- ---- --- -- - - -
>
Reply With Quote
cquirke (MVP Windows shell/user)
Guest
Posts: n/a
 
Re: XCOPY /exclude file not read
Posted: 07-09-2007, 08:38 PM
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...
>> /exclude:_"C:\Documents_and_Settings\hmm\Applicatio n_Data\Microsoft\Templates\ExclBkUp.txt"
>> /exclude:_C:\Docume~1\hmm\Applic~1\Micros~1\Templa~ 1\ExclBkUp.txt
>...I get the message "Invalid number of parameters."
That clarifies that, good...
>> /exclude:"C:\Documents_and_Settings\hmm\Application _Data\Microsoft\Templates\ExclBkUp.txt"
>...I get the "Can't read file... 0 files copied" message.
>> /exclude:C:\Docume~1\hmm\Applic~1\Micros~1\Templa~1 \ExclBkUp.txt
>...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.
>--------------- ----- ---- --- -- - - -
Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XCopy Exclude Syntax Vincent Xu [MSFT] Windows XP Configuration & Management 1 01-15-2007 04:53 AM
Why can't you exclude certain file types in SyncToy? Kevin Windows XP Photos 1 08-18-2006 08:37 PM
Cannot delete file: Cannot read from the source file or disk. Jim Macklin Windows XP Help & Support 0 11-06-2003 07:35 AM
xcopy in batch file Joskin Windows XP Basics 2 07-28-2003 06:43 PM
Cannot delete file: Cannot read from the source file or disk. Windows XP 0 07-21-2003 12:11 AM


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90