|
Answer» Hello all, I am a beginner using MS-dos so i might not know all the exact terms used to describe my problem.
I am working on a batch file to move large amounts of files, the issue I am having is that dos picks up a syntax error when it reaches a document or folder name that has spaces in it such as (C:\WINDOWS\Connection Wizard) the space in between connection and wizard would set off this error
My QUESTION is if there is anyway around this?
Thank you.
my second post, reply # 2, has updates to my situation.well what you could do is use the /s sysntax:
Code: [Select]XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+FILE2][+file3]...]
source Specifies the file(s) to copy. destination Specifies the location and/or name of new files. /A Copies only files with the archive attribute set, doesn't change the attribute. /M Copies only files with the archive attribute set, turns off the archive attribute. /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. /EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings. Each string should be in a separate line in the files. 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. /P Prompts you before creating each destination file. /S Copies directories and subdirectories except empty ones. /E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T. /V VERIFIES each new file. /W Prompts you to press a key before copying. /C Continues copying even if errors occur. /I If destination does not exist and copying more than one file, assumes that destination must be a directory. /Q Does not display file names while copying. /F Displays full source and destination file names while copying. /L Displays files that would be copied. /G Allows the copying of encrypted files to destination that does not support encryption. /H Copies hidden and system files also. /R Overwrites read-only files. /T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories. /U Copies only files that already exist in destination. /K Copies attributes. Normal Xcopy will reset read-only attributes. /N Copies using the generated short names. /O Copies file ownership and ACL information. /X Copies file audit settings (implies /O). /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode.
The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line. but you may run into the error: Code: [Select]Cannot PERFORM a cyclic copy 0 File(s) copied and to fix. create a new folder: c:\files_to_copy
then in your batch file: Code: [Select]xcopy /s c:\windows\files\*.* c:\files_to_copy\*.*thank you that seems like alot though just to make dos ignore that there are spaces within a folder or file name. sorry that I did not post these up last night, I did not have access to these from my home computer, but these are actual codes im using for this batch file then running in dos and they do not seem anything near to what you wrote. this code actually worked but not sure why move G:\Adam-Invoice\Invoice.doc G:\FileStructure\QWI Manual\QWI 5- Purchasing\
this one did not work because it had a space in the folder name move G:\Adam-Invoice\Cardinal Cogen-Invoice.doc G:\FileStructure\QWI Manual\QWI 5- Purchasing\
same as above move G:\BETZ\GE Water Service Reports\Reports 2003\Cardinal Towers 1-9-03.doc G:\FileStructure\QWI Manual\QWI 6- Facility Operation\6.1 Facility Operations Standard\Reports\2003\Tower\
Just wondering if there is something more simple then the previous reply, or if there is some sort of compiler that i could use to make dos compatible with spaces within a file name. thank you well what i was putting was: Code: [Select]xcopy /s c:\windows\files\*.* c:\files_to_copy\*.*sorry I did not understand it at first but got it now. Thank you for all of your helpDOS does not understand spaces.
You NEED quotes.
e.g. C:\Documents and Settings\Dad>DIR C:\Documents and Settings\Dad The system cannot find the file specified.
add the quotes and you get C:\Documents and Settings\Dad>DIR "C:\Documents and Settings\Dad" Volume in drive C is ACER Volume Serial Number is EC16-8702
Directory of C:\Documents and Settings\Dad
20/05/2003 18:31 2,682 launApp.log 06/06/2009 19:14 My Documents 12/06/2009 16:40 7,602,176 ntuser.bak 13/06/2009 11:58 6,815,744 ntuser.dat
Regards Alan
|