Re: xcopy Can't read file: .txt

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

All
I think the issue has to do with path. Even though /exclude:filename
is a new caommand for Windows 2000 (at least according to the docs),
this switch appears to be a copy of /e from earlier versions. We could
not get this to work either, until someone suggested putting the
exclude file in the root. That worked. We went back to the batch file
and used old DOS naming conventions for longfilenames in the path,
that worked as well. Conclusion, /exclude cannot read longfilenames,
and needs an absolute path to its intended file.

Hope this helps.

Kevin
 
Despite how the command prompt appears to work in regards to filename
conventions, the safest way to write any command prompt is to escape the
filenames with quotes. This forces the command shell to handle it and pass
the results to whatever you called. You can also use ".\" before any file
descripter to force it to look locally, creating this:

xcopy *.* C:\a /D:06-11-2003 /EXCLUDE:".\ListofTxtFiles.txt" /S/E/I/Y

Would parse a file ListofTxtFiles.txt containing strings (in this case .txt)
that xcopy should exclude. If using this for scripts, try creating a root
directory of Scripts and store the exclusion files there, add an enviroment
variable, and parse that, IE:

SET ExclPath=C:\Scripts\Exclusion
xcopy *.* C:\a /D:06-11-2003 /EXCLUDE:"%ExclPath%\ListofTxtFiles.txt"
/S/E/I/Y

(e-mail address removed)
 
In fact on win2000 if I take off the "" in
/EXCLUDE:".C:\Scripts\Exclusion\file.txt"
it works
 
Back
Top