+ Post New Thread
Results 1 to 6 of 6
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
    974
    Thank Post
    91
    Thanked 14 Times in 13 Posts
    Rep Power
    21

    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. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,013
    Thank Post
    120
    Thanked 282 Times in 260 Posts
    Rep Power
    108

    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.

  3. #3
    meastaugh1's Avatar
    Join Date
    Jul 2006
    Location
    London/Hertfordshire
    Posts
    890
    Thank Post
    69
    Thanked 85 Times in 70 Posts
    Rep Power
    32

    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

  4. #4

    Join Date
    Feb 2006
    Posts
    1,187
    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.

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

    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.

  6. #6
    Goku's Avatar
    Join Date
    Jan 2013
    Location
    King kai place
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    AAS.jpg
    Great this helped Great! xcopy DIR FOLDER NAME F: (FOLDER #2 name)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 1
    Last Post: 21st January 2007, 02: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, 06: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 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
  •