xcopy selected folders
Results 1 to 10 of 10

Thread: xcopy selected folders

  1. #1
    Join Date
    Jan 2000
    Location
    Ipswich, UK
    Posts
    81

    xcopy selected folders

    Hi there.

    I'd like to make a batch file that will copy selected folders and sub folders within those from a network location to en external drive.

    The network drive is mapped to F: on the pc I'm using.

    And the external drive is P:

    Let's say the folders on F that I wish to xcopy are called Alpha, Beta and Gamma.

    What would be the command that would copy these 2 folders and all their sub folders to P:\backup

    I know all about switches and presume they would go at the end of the command as usual.

    I have posted here as I thought it was the best place but if anybody feels this is not the correct forum area please move my post to one that is.

    Thanks in advance

    SS UK

  2. #2
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    As a single command:
    Code:
    for %x in (alpha beta gamma) do xcopy f:\%x\*.* p:\backup\%x /e /i
    Which produces the same results as these three separate commands:
    Code:
    xcopy f:\alpha\*.* p:\backup\alpha /e /i
    xcopy f:\beta\*.* p:\backup\beta /e /i
    xcopy f:\gamma\*.* p:\backup\gamma /e /i

  3. #3
    Join Date
    Jan 2000
    Location
    Ipswich, UK
    Posts
    81
    Great

    Thanks

    Sorry for double posting.

    Don't suppose there is a similar command for xcopying all the folders in APART from those specified is there?

    Only because the number of folders that I DO wish to xcopy is by far geater then the number of those that I DONT.

    Cheers

  4. #4
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    If you're using XP, do a:
    xcopy /?
    at a CMD prompt and note the
    /exclude:...
    option.

  5. #5
    Join Date
    Jan 2000
    Location
    Ipswich, UK
    Posts
    81
    xcopy f:\*.* p:\gav\backups\fdrive /e/h/k/y/c/r/o/i/EXCLUDE:\rack\+\archive\

    Could you tell me what's wrong with this please?

    It's not working for me.

    I'm trying to copy all files under f:\ apart from the rack and archive folders and all files within.

    I don't have a gap between the * and the p on the command line, it's just the way it's posted here.

    Thanks

  6. #6
    HAN's Avatar
    HAN is offline Virtual PC Specialist!!!
    Join Date
    Feb 2002
    Location
    USA
    Posts
    4,319
    SS UK: If I may, I'd like to suggest something much much easier than xcopy. If you are running in Windows, try free SyncBack. You can do straight backups or synchronizations. Short learning curve and reliable. I couldn't function without it.

    http://www.snapfiles.com/get/SyncBack.html

  7. #7
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    Quote Originally Posted by SS UK
    xcopy f:\*.* p:\gav\backups\fdrive /e/h/k/y/c/r/o/i/EXCLUDE:\rack\+\archive\

    Could you tell me what's wrong with this please?

    It's not working for me.

    I'm trying to copy all files under f:\ apart from the rack and archive folders and all files within.

    I don't have a gap between the * and the p on the command line, it's just the way it's posted here.

    Thanks
    You need to list each string that you want to exclude on separate lines in a text file, (and then specify the name of this file in your XCOPY command).

    If any of your listed strings match any part of the absolute path of any file to be copied, that file will then be excluded from the copying process.

    For example, if you specify the string "\Obj\", you exclude all files underneath the Obj directory. If you specify the string ".obj", you exclude all files with the .obj extension. If you specify the string "obj", you exclude everything with the string "obj" anywhere in the absolute path.

  8. #8
    Join Date
    Jan 2000
    Location
    Ipswich, UK
    Posts
    81
    Thanks for all help

    On this occasion I've deployed the software suggested by HAN

    I've done some dummy runs and verified the data and it looks to work fine for me.

    There's a setting in there that lets you not use windows shell for copying.

    When I use ntbackup to back up Novell files it does not do it properly. All the file sizes are wrong.

    I have posted about this on here but I think it's foxing people as to why.

    This Syncback seems to cope ok with it. The check box to not use the Winows Shell even mentions that it may solve some Novell Server problems.


    Thanks

  9. #9
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    You're welcome. Good to hear you found a workable solution.

  10. #10
    HAN's Avatar
    HAN is offline Virtual PC Specialist!!!
    Join Date
    Feb 2002
    Location
    USA
    Posts
    4,319
    Glad to hear it works for you too! Great little app...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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