[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
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,
Here 123.txt is the file you want to copy.That is for copy a file.
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.
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
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 for the usage. The switches should be the last parameters.
Code:
xcopy C:\MyVideos D:\Temp\Backups /E /I
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.
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:\
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.
Re: how to copy files and folders in command prompt
Yes seems to me it take a long time. Better to test it. Thanks.
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
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.
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.
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.
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
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.