# Vista DOS file management



## Bozidar (Oct 31, 2007)

How can I merge all the files from two (or more) folders into another NEW Folder in Vista DOS ??

1) Can two folders be merged into a new Folder while retaining only the latest dated version of a file ??

2) Also have no prompting to override duplicate files

3) Is this possible in Vista using the xcopy command from the DOS command prompt ??

4) Or can this best be done with a Batch file using %1 %2 etc. ??

Thanks for your help

Bozidar


----------



## TheOutcaste (Aug 8, 2007)

Xcopy can copy the files. If you want to remove them from the original folders you'd have to run a separate delete command.

Robocopy would be a better choice, as it can also move files instead of just copy.

If both folders have files with the same name, either Xcopy or Robocopy can be set to keep the newest version, and to not prompt for overwriting.


----------



## Bozidar (Oct 31, 2007)

TheOutcaste: 

Thanks for your advice. I plan to use Xcopy/s/d/y - and after inspection of the new Folder - get rid of the older folders using RD/s

How does that sound ??

Theodore


----------



## TheOutcaste (Aug 8, 2007)

Sounds good ro me. I usually use these switches with Xcopy as well
C - Continues if there is an error. Otherwise it stops copying
H - Copies Hidden and System files.
R - Copies Read Only files. Files transferred on a CD might be flagged Read Only without being noticed
V - Verifies file sizes after they are copied. Just a little extra check that there were no problems. Doesn't verify contents, just that the sizes match.

The switches can be combined as one switch:
*Xcopy /CDHRSVY "Source" "Destination\"*

A trailing slash on the destination confirms the Destination is a folder name and avoids this prompt:
*Does <Destination> specify a file name
or directory name on the target
(F = file, D = directory)?*


----------



## Bozidar (Oct 31, 2007)

Hello Outcaste and thanks for the enligtening help. Now I am in the process of finding and deleting very old files.

This command : 

dir/s|find "1995" |more 

will list all 1995 files - is there any DOS comand which will delete them ??

Thanks for your help

Bozidar


----------



## TheOutcaste (Aug 8, 2007)

You don't need to use find or more to find those files:
*Dir /P /S 1995*.**

This will delete them:
*Del /S 1995*.**

EDIT: This assumes the files names start with *1995*

Be aware that files deleted from the Command Prompt do not go to the Recycle Bin, so make sure you are in the correct folder, and specifying enough of the file name to only delete the files you want to delete.


----------



## TheOutcaste (Aug 8, 2007)

Mixing this up with another thread. The above post only applies if the file names start with 1995. If the "1995" part is not at the beginning of the file name, the DIR command won't find them, and a different method would be needed to delete them.


----------



## Bozidar (Oct 31, 2007)

Hello Outcaste: After messing around with the DIR command I found out that by using three asterisks I could find both beginning and embedded dates. 

Dir /P /S *2001*.* 

And then by using the next commad Del/s *2001*.* I could delete them 

Bozidar


----------



## TheOutcaste (Aug 8, 2007)

That format doesn't always work as expected. It will find 2001 anywhere in the file name _including_ the extension.
**2001** will probably give the same result.
Example, Search on **tx*.** and it will find all **.txt* files, not just files that have *tx* in the name portion.

I don't know if the delete command finds file names with the same algorithm, so even if Dir shows only the files you want, there is a slight chance that Del will either not delete all of them, or may find and delete files that the Dir command didn't show.

I wouldn't trust it myself, at least not to use as an automated system without reviewing the files it finds first.


----------

