Results 1 to 15 of 15

Thread: [RESOLVED] how to copy files and folders in command prompt

  1. #1

    Thread Starter
    Fanatic Member ksuwanto8ksd's Avatar
    Join Date
    Apr 2005
    Posts
    636

    Resolved [RESOLVED] how to copy files and folders in command prompt

    I have file and folder in desktop, how do I copy it to c:\ using command promp?

    i tried :
    1. copy *.* c:\
    2. copy. c:\
    but it only copied all files except folder. I want all folder and subfolders also included
    I 'm using winxp professional sp2

    Any help is greatly appreciated
    thanks in advance

    Regards,
    Cesin

  2. #2
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: how to copy files and folders in command prompt

    Go to the command prompt.

    Start -> Run -> type cmd and click ok

    Automatically you are directed to your account. Say login as a user. Your prompt display as follows,

    Code:
    C:\Documents and Settings\User>
    Change the path to Desktop
    Code:
    C:\Documents and Settings\User>cd desktop
    C:\Documents and Settings\User\Desktop>
    Type the command,

    Code:
    copy 123.txt C:\
    Here 123.txt is the file you want to copy.That is for copy a file.
    Last edited by eranga262154; Oct 11th, 2007 at 04:34 AM. Reason: Adding more
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  3. #3
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: how to copy files and folders in command prompt

    Quote Originally Posted by ksuwanto8ksd

    i tried :
    1. copy *.* c:\
    2. copy. c:\

    You have use xcopy. On your first attempt, it wont copy subdirectories and it contents, isn't it?

    Try it in this way.

    Code:
    xcopy /t /e C:\Documents and Settings\User\Desktop\abc\ *.* C:\
    Here abc is the folder on your desktop. Check is it work...

    /t /e stand for specifying folders and sub folders.
    Last edited by eranga262154; Oct 11th, 2007 at 04:42 AM. Reason: Adding more
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  4. #4

    Thread Starter
    Fanatic Member ksuwanto8ksd's Avatar
    Join Date
    Apr 2005
    Posts
    636

    Re: how to copy files and folders in command prompt

    eranga thanks for help
    it say invalid number of parameter when I use:
    Code:
    xcopy /t /e c:\documents and settings\user\desktop\*.* c:\
    I'm using administrators privilage on this computer
    also I tried:
    Code:
    xcopy /t /e c:\documents and settings\administrator\desktop\*.* c:\
    it say invalid number of parameter

    Regards,
    Cesin

  5. #5
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: how to copy files and folders in command prompt

    Specifying /T as a parameter prevents the copying of files - it only creates a directory structure. Start a command prompt window and type
    Code:
    xcopy /?
    for the usage. The switches should be the last parameters.
    Code:
    xcopy C:\MyVideos D:\Temp\Backups /E /I

  6. #6
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: how to copy files and folders in command prompt

    to copy subfolders, use the /s parameter.
    xcopy d:\foldername c:\ /s

    also keep in mind that xcopy requires all parameters to appear at the end.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  7. #7
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: how to copy files and folders in command prompt

    Quote Originally Posted by ksuwanto8ksd
    I'm using administrators privilage on this computer
    also I tried:
    Code:
    xcopy /t /e c:\documents and settings\administrator\desktop\*.* c:\
    it say invalid number of parameter
    Have you give the folder name there, say folder name is a, so

    Code:
    xcopy /t /e c:\documents and settings\administrator\desktop\a*.* c:\
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  8. #8
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: how to copy files and folders in command prompt

    you not only had a typo there (you left out \ before *.*) but the *.* part is actually unnecessary with xcopy. Also since you are running this in xp most likely, you should use the 32-bit version of the program, xcopy32.exe which functions the same, has more options, and is faster.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  9. #9
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: how to copy files and folders in command prompt

    Yes seems to me it take a long time. Better to test it. Thanks.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  10. #10

    Thread Starter
    Fanatic Member ksuwanto8ksd's Avatar
    Join Date
    Apr 2005
    Posts
    636

    Re: how to copy files and folders in command prompt

    eranga and lord orwell thanks your support

    I still cant copy file with these
    Code:
    xcopy /t /e c:\documents and settings\administrator\desktop\a*.* c:
    also
    Code:
    xcopy c:\documents and settings\administrator\desktop\a*.* c:\ /s
    also this
    Code:
    xcopy c:\documents and settings\administrator\desktop\*.* c:\ /s
    it give an error invalid number of parameters
    but when I try copy this file, it is working
    Code:
    copy config.sys c:\a
    a is folder name

    Regards,
    Cesin Lim

  11. #11
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: how to copy files and folders in command prompt

    Quote Originally Posted by ksuwanto8ksd
    but when I try copy this file, it is working
    Code:
    copy config.sys c:\a
    a is folder name

    It's ok. Because you copied a file to a folder. Here our issue is folder content not copied. Let see.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  12. #12
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: how to copy files and folders in command prompt

    Quote Originally Posted by ksuwanto8ksd
    also
    Code:
    xcopy c:\documents and settings\administrator\desktop\a*.* c:\ /s
    I've try it.

    You have make slight change on this code. Neglect *.* and try it. Works for me. Just like this.

    Code:
    xcopy c:\documents and settings\administrator\desktop\a c:\ /s
    This is copy all the files and folders(including sub folders) to the specified place. Here from folder a to the c drive.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  13. #13
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: how to copy files and folders in command prompt

    change this:
    xcopy c:\documents and settings\administrator\desktop\*.* c:\ /s
    to this:
    xcopy "c:\documents and settings\administrator\desktop\*.*" c:\ /s

    spaces separate different parameters. you need to enclose it in quotes so it knows that is one parameter only. Either that or use the 8.3 filename format.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  14. #14

    Thread Starter
    Fanatic Member ksuwanto8ksd's Avatar
    Join Date
    Apr 2005
    Posts
    636

    Re: how to copy files and folders in command prompt

    eranga this is not working
    Code:
    xcopy c:\documents and settings\administrator\desktop\a c:\ /s
    lord orwell this is working fine:
    Code:
    xcopy "c:\documents and settings\administrator\desktop\*.*" c:\ /s

    lord orwell could you explaint why should used "...". I look at the xcopy /? they didnt use "..."

    Thanks eranga and lord orwell, all your support and help are very much appreciated.

    Regards,
    Cesin

  15. #15
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [RESOLVED] how to copy files and folders in command prompt

    ... is not an xcopy command. it is a directory shortcut. There is no reason not to use it. it simply means go up 2 levels in the directory tree.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

Posting Permissions

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



Click Here to Expand Forum to Full Width