Copy All Files and Directories Using just the copy command

Is there a way to copy all the files and subdirectories under a directories using just the DOS copy command. I am trying to copy large directory from a laptop that would not boot. I am able to list the files after booting using a dos boot disk.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Not using COPY.  You will need XCOPY.EXE with the "/S" option.  Check to see if XCOPY is on your boot disk.
Furthermore, if you want to backup from a directory rather than a root drive, I would combine the features of the SUBST command (you will need the SUBST.EXE file on your boot disk or some accessible path, as the SUBST command is also external).

Assumming LASTDRIVE is set accordingly, you could use the following:

For example, lets assume the directory on your laptop which you want to rescue is:


Then (for example - I use "x" in the subst command below.  You can use any drive letter as long as the bootdisk has LASTDRIVE set >= the drive letter).  Also, you did not specify what media you would be copying the data to.  Let's assume it's another harddrive in the system or perhaps a removable drive (such as a ZIP or some other USB or Firewire device) and it's drive letter assigned by the boot disk is "F:"

A:> subst x: c:\backup\archive\dir"
A:> xcopy /s x: f:

The commands above should do as you like.  If The drive "F:" has stuff on it already, you may wish to create a seperate folder on the drive and use yet another SUBST to alias the directory, for example:

A:> cd f
F:> md rescue
F:> cd rescue
F:\rescue> subst y: .
F:\rescue> a:
A:> xcopy /s x: y:


Hope this helps you,

There is a leftover trailing quote which should not be there in my last post:

A:> subst x: c:\backup\archive\dir"


A:> subst x: c:\backup\archive\dir

OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

jineshsAuthor Commented:
Xcopy would not work as I don't have that available with the boot that I have.
I have a laptop that has a corrupt windows 2000 and is not repairable. I have boot up using ghost boot disk and so I am able to connect to the network and copy the files to the network. The ghost boot disk has PC-Dos as the OS.
There is a folder which has a lot of subfolders which I need to copy and the only command available is COPY.
I tried to put the xcopy file on a floppy and use that on the laptop but it says that it is 'incorrect dos version'. The xcopy was from msdos 6.22.
Any other suggestion would be helpful.
Is the drive NTFS or FAT32?
tried xxcopy16?
jineshsAuthor Commented:
The drive was in NTFS.
I have not tried xxcopy16.

I was able to get it work. I boot up the Laptop using the ghost network boot disk so I can map to a network drive. Then I use utility readntfs ( so I could read the files on the hard drive. The readntfs utility has a copy command which copies all the files and folder under the folder selected.

Thanks everybody for all you help.

Perhaps this utility might help:


NTFS Reader for DOS provides read access to NTFS drives from the MS DOS environment. It supports long filenames as well as compressed and fragmented files. NTFS Reader for DOS allows you to preview the files on NTFS and copy them from NTFS to FAT volumes or network drives. In order to use the software you need to copy the readntfs.exe file to a bootable floppy disk and boot from it.  789KB
Damn.  Sorry, jineshs, I forgot to reload the question before posting.
jineshsAuthor Commented:
Thanks, BillDL
No problem, jineshs.  In view of the fact that you have found the solution to this problem, and sorted things out, then perhaps you should ask for your points back and ask for the question to be closed.  If however, you did feel that any expert's comments guided you towards this solution, then you could accept that expert's comment.  The choice is yours, but in the end the solution was yours.

To ask for closure and return of points, post a zero-value comment for the attention of the administrators in and paste the url to this question along with your request.

Regards, Bill
PAQed, with points refunded (125)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
In Win98 original (not SE) xcopy command does NOT copy hidden or system files ever.  Using either WUCSP.EXE or ADVPACK.EXE (updaters for Win98) you can upgrade xcopy.exe.  It will only copy hidden system files from within Windows.  My favorite xcopy command is

xcopy source dest /s /e /c /h /k /r

/s=Copy subdirectories
/e=Copy empty subdirectories also
/c=Continue copying even if an error occurs.  Important if trying copy files in use.
/h=Copy hidden files
/k=Copy system files (I think)
/r=Copy read only files (I think)
example: xcopy c:\*.* d:\ /s /e /c /h /k /r... All of C to drive D
That is strange, happispider.  I have used the bog-standard xcopy and xcopy32 from the Win 98 First Edition CD (4.10.1998 April 1998) under \tools\oldmsdos.  They are both dated 11 May 1998 20:01:00 and are fully capable of copying hidden files without any updates, as long as the appropriate switch is used.

The reason for this is the presence of the file xcopy32.mod which contains the command options available to xcopy.exe and xcopy32.exe.  Without this file, an error message will be issued from either of these .exe's : "Bad or missing XCOPY32.MOD"

You seem to be unsure of a couple of the switches.  This is easily resolved for accuracy:

xcopy /? > c:\windows\desktop\xcopy_syntax.txt

Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
                           [/K] [/N]

source       Specifies the file(s) to copy.
destination  Specifies the location and/or name of new files.

/A  - Copies files with the archive attribute set, doesn't change the attribute.
/M - Copies files with the archive attribute set, turns off the archive attribute.
/D:date - 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.
/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.
/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.
/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-   Updates the files that already exist in destination.
/K -  Copies attributes. Normal Xcopy will reset read-only attributes. *****
/Y -  Overwrites existing files without prompting.
/-Y - Prompts you before overwriting existing files.
/N - Copy using the generated short names.

You will find that xcopy.exe and xcopy32.exe are found in "WIN98_43.CAB".  I can't see immediately which .cab file the .mod file is contained in, but the following commands will extract them (where G:\ is your CD Rom):

@echo off
EXTRACT /Y /A  G:\win98\BASE4.CAB  xcopy.exe  /L c:\windows\command
EXTRACT /Y /A  G:\win98\BASE4.CAB  xcopy32.exe  /L c:\windows\command
EXTRACT /Y /A  G:\win98\BASE4.CAB  xcopy32.mod  /L c:\windows\command

The reason I say this, is because those are the files that are installed courtesy of the setup routine.  The same file versions are present in the \tools\oldmsdos folder.

What about he need without prompt copy I mean if he trying to copy all files and that command will give “Overwrite D:\a2\files_done.doc (Yes/No/All)?” is there any way void this prompt??
 /Y     Overwrites existing files without prompting
 /-Y    Prompts you before overwriting existing files

  /Y     Overwrites existing files without prompting
  /-Y    Prompts you before overwriting existing files

Default    Prompts you before overwriting existing files
  /Y          Overwrites existing files without prompting
Please note that this question is closed.
Pls tell me how dos boot process, win98 occus

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.