|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
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?
|
|
On Thu, 5 Jul 2007 01:36:00 -0700, hmm
[Quoted Text] >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? >--------------- ----- ---- --- -- - - -
|
|
Thanks for your help, cquirke. However, I still get the same error message.
"cquirke (MVP Windows shell/user)" wrote:
[Quoted Text] > 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? > >--------------- ----- ---- --- -- - - - >
|
|
On Sat, 7 Jul 2007 23:50:00 -0700, hmm wrote:
[Quoted Text] >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... >-------------------- ----- ---- --- -- - - - -
|
|
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
"cquirke (MVP Windows shell/user)" wrote:
[Quoted Text] > 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... > >-------------------- ----- ---- --- -- - - - - >
|
|
On Sun, 8 Jul 2007 06:22:00 -0700, hmm <hmm[ at ]discussions.microsoft.com>
[Quoted Text] >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 >--------------- ----- ---- --- -- - - -
|
|
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:
[Quoted Text] > On Sun, 8 Jul 2007 06:22:00 -0700, hmm <hmm[ at ]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\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 > >--------------- ----- ---- --- -- - - - >
|
|
On Mon, 9 Jul 2007 06:04:00 -0700, hmm
[Quoted Text] >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\Application_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. >--------------- ----- ---- --- -- - - -
|
|
|