Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Feb 2009
    Location
    Evanston, Illinois, USA
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How can I merge all the files from two folders into another NEW Folder in Vista DOS ??

    1) Can two folders be merged into a new Folder ??

    2) I would like the latest dated filename to be retained in the new Folder

    3) No prompting to override duplicate files

    Is this possible in Vista using the DOS command prompt ??

    Thanks for your help

    Theodore

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,827
    Thanks
    19
    Thanked 109 Times in 103 Posts
    How about the following, whose meaning should be clear. I am presuming that there are no subdirectories in the two source directories...?
    Code:
    xcopy c:\source-one\*.*  c:\target\ 
    xcopy c:\source-two\*.*  c:\target\  /d  /y
    'Check out' the switches using XCOPY /? if you have any queries.
    BATcher

    Dear Diary, today the Hundred Years War started ...

  3. #3
    Star Lounger
    Join Date
    Feb 2009
    Location
    Evanston, Illinois, USA
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  4. #4
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,827
    Thanks
    19
    Thanked 109 Times in 103 Posts
    Quote Originally Posted by Theodore View Post
    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 command which will delete them ??
    It will also find any file which has 1995 in the filename! (I had some in my own test directory...).

    Copy the following into a batch file in the top-level directory you want to work on:
    Code:
    @echo off
    for /f "tokens=1,3*" %%a in (' dir /s ^| find "-1995" ') do echo %%a "%%c"
    :: if you're happy with the output, change above to...   do del "%%c"
    I am assuming that you use the US standard m-dd-yyyy format, and am thus checking for "-1995" to ensure that success only happens in the date and not the filename (ok, assuming the filename is not perverse enough to include "-1995"!).

    Run it once, and you should get one line per file whose modified date is in 1995, with the date and then the filename in double quotes.

    When you are entirely happy with the files that are produced, edit the batch file as indicated, replacing at the end do echo %%a "%%c" with do del "%%c" - this should delete what you want, when you run the batch file again.

    To be really, really sure that it will work, copy the whole directory tree to another directory, and work on it there.

    If you are familiar with Windows Explorer, you could sort each directory in date order, and delete the files with the usual "hold down Shift/highlight first 1995 file/highlight last 1995 file/press Delete" method...

    Whichever you feel more comfortable with!
    BATcher

    Dear Diary, today the Hundred Years War started ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •