+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, Code for CMD file to copy folder and contents to other Drive in Coding and Web Development; If i have a folder path of C:\folder A\folder B\my folder what line could i use in a CMD file ...
  1. #1
    Kyle's Avatar
    Join Date
    Jan 2006
    Posts
    820
    Thank Post
    39
    Thanked 8 Times in 7 Posts
    Rep Power
    15

    Code for CMD file to copy folder and contents to other Drive

    If i have a folder path of C:\folder A\folder B\my folder what line could i use in a CMD file to copy 'My Folder' and all its subfolders and files to the root of C:\ ?

    COuld someone give me ideas?

  2. IDG Tech News

  3. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,810
    Thank Post
    89
    Thanked 212 Times in 195 Posts
    Rep Power
    83

    Re: Code for CMD file to copy folder and contents to other Drive

    Code:
     
    copy "C:\folder A\folder B\my folder\*.*" c:\myfolder
    *.* denotes everything or you could say all word docs like *.doc . * is used as a wild card. A more robust copy command is Robocopy which you can download.

  4. #3
    meastaugh1's Avatar
    Join Date
    Jul 2006
    Location
    London/Hertfordshire
    Posts
    852
    Thank Post
    59
    Thanked 76 Times in 63 Posts
    Rep Power
    25

    Re: Code for CMD file to copy folder and contents to other Drive

    xcopy "c:\folder a\folder b\my folder\*.*" "c:\*.*" /s /e /c

  5. #4

    Join Date
    Feb 2006
    Posts
    1,193
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Code for CMD file to copy folder and contents to other Drive

    The /s is redundant when there is already an /e.
    Also in that example unless you specify a destination folder the files will be copied to the root of the c: drive.

    Try something like this

    Code:
    xcopy  e:\source_folder f:\destination_folder /e /i /h
    The /h is just in case there are hidden files. The /i creates a destination folder if there are muliple source files.

  6. #5
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,565
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    17

    Re: Code for CMD file to copy folder and contents to other D

    xcopy e:\source_folder f:\destination_folder /e /i /h
    I tried this today and it works well.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 1
    Last Post: 21st January 2007, 03:51 PM
  2. VB Script ti check for folder and then copy contents to PC
    By tosca925 in forum How do you do....it?
    Replies: 4
    Last Post: 2nd October 2006, 08:15 PM
  3. Replies: 4
    Last Post: 23rd March 2006, 07:27 AM
  4. Deploy the contents of a CAB file through GPO?
    By tosca925 in forum Windows
    Replies: 0
    Last Post: 16th October 2005, 12:46 PM
  5. Replies: 2
    Last Post: 1st October 2005, 02:55 PM

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 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
  •