General discussion


Basic DOS copy

By tom.young ·
Tags: Off Topic
I have a program that creates a complex "subdirectory" structure that changes each day. I am trying to copy the files from each subdirectory to a new directory. When I use the xcopy /s command, I get the subdirectory structure in the new directory. I only want the files.

Any ideas on how to get files without the directories?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Basic DOS copy

by Plenpek In reply to Basic DOS copy

Try copying using the file extension. For example
if file is excutable try

drive:\dir\xcopy *.exe /s drive:\dir

where drive is the your drive letter and dir is the name of the directory where you copy files. Good luck

Collapse -

Basic DOS copy

by tom.young In reply to Basic DOS copy

When I do the xcopy c:\test\*.txt /s c:\tom

It copies all of the files and the subdirectory structure. I only want the files.



I run: c:\test\xcopy *.txt /s c:\tom

I get:

I want:

Collapse -

Basic DOS copy

by krystal190 In reply to Basic DOS copy

Use the "copy" command instead. The "Xcopy" command is used to copy all directories and subdirectors.

Collapse -

by Net Designer In reply to Basic DOS copy

can't do it with xcopy

Collapse -

by evalega In reply to Basic DOS copy

xcopy includes all subdirectories. You should create a batch file using copy command and not xcopy command.

Collapse -

by stevecottle In reply to Basic DOS copy

I know there's a way to fully automate this using multiple batch files and recursive calls, but the simpler approach if you don't have to do this over and over is the "DIR mydir /S /B > C:\TEMP.TXT" command. This creates a "bare" version of the file list. Specify the directory you want to copy files from instead of "mydir". This will create a TEMP.TXT file on the root directory of your C: drive. You then can edit TEMP.TXT to add "COPY " to the beginning and your destination directory to the end of each line. Save it as TEMP.BAT, and execute it from a DOS prompt. I'd need to go back to PC Magazines from 1985, 1986 to come up with the fully automated recursive technique. It's been a long time.

Collapse -

by davidfranks78 In reply to Basic DOS copy

If you are using windows, how about using the search utility (*.<file extenstion&gt. All the found files can be blocked and copied / moved


Back to After Hours Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums