Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Copy All Files and Directories Using just the copy command

Posted on 2003-12-02
Medium Priority
Last Modified: 2011-08-18
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.
Question by:jineshs
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 3
  • +5

Expert Comment

ID: 9863240
Not using COPY.  You will need XCOPY.EXE with the "/S" option.  Check to see if XCOPY is on your boot disk.

Expert Comment

ID: 9864055
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,


Expert Comment

ID: 9864061
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.


Author Comment

ID: 9876301
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.
LVL 38

Expert Comment

ID: 9918228
Is the drive NTFS or FAT32?
LVL 18

Expert Comment

ID: 9918351
tried xxcopy16?

Author Comment

ID: 9920272
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 (http://www.ntfs.com) 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.

LVL 38

Expert Comment

ID: 9921236
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.

http://paulsxp.com/files/readntfs.zip  789KB


LVL 38

Expert Comment

ID: 9921250
Damn.  Sorry, jineshs, I forgot to reload the question before posting.

Author Comment

ID: 9921474
Thanks, BillDL
LVL 38

Expert Comment

ID: 9925626
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 http://www.experts-exchange.com/Community_Support/ and paste the url to this question along with your request.

Regards, Bill

Accepted Solution

PashaMod earned 0 total points
ID: 10097624
PAQed, with points refunded (125)

Community Support Moderator

Expert Comment

ID: 10295538
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
LVL 38

Expert Comment

ID: 10297206
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.


Expert Comment

ID: 10530088
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??
LVL 38

Expert Comment

ID: 10531022
 /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.

Expert Comment

ID: 10763682
Pls tell me how dos boot process, win98 occus


Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question