DOS Xcopy Command Help: Copy Folders to Multiple Locations

  • Thread starter Thread starter Dave Ritche
  • Start date Start date
  • Tags Tags
    Dos
AI Thread Summary
The discussion centers on using the DOS copy command to transfer folders from USB drives, specifically addressing the need to copy all folders while excluding certain file types, like .exe files. Users inquire about the feasibility of copying from multiple drives simultaneously and seek methods to execute these commands silently, without displaying command prompts. Suggestions include using the xcopy command with specific parameters to exclude files and employing VBScript to run the operation quietly. There is also mention of zipping files as an alternative method for transferring data. Additionally, participants discuss the possibility of automating the process to trigger when a USB drive is inserted, which would require additional configuration. The conversation highlights the importance of understanding command syntax and scripting to achieve the desired file management tasks effectively.
Dave Ritche
Messages
70
Reaction score
6
Hello!
I am trying to run Dos copy command butim a confused a little about using it to copy folders to multiple folders.My problem is to write a command that will copy all folders from a source that could be something like G:\ or H:\ i.e from USB drive.Can i use G and H both at a time?
Thanks in advance!
 
Technology news on Phys.org
https://support.microsoft.com/en-us/kb/240268
 
  • Like
Likes Dave Ritche
theodoros.mihos said:
https://support.microsoft.com/en-us/kb/240268
Thanks...
 
An alternative approach is to zip up all the folders and files, copy the compressed zip to where you want and then unzip it in the new location.

You might need to download the zip tool though and will need sufficient space for the zip file and the unzipped files.
 
  • Like
Likes Dave Ritche
jedishrfu said:
An alternative approach is to zip up all the folders and files, copy the compressed zip to where you want and then unzip it in the new location.

You might need to download the zip tool though and will need sufficient space for the zip file and the unzipped files.
Thanks but what if i don't know the files or folders already?
I'm looking for a command that will copy all the folders of a drive...
 
If you know the drive then you know the root folder.
 
  • Like
Likes Dave Ritche
jedishrfu said:
If you know the drive then you know the root folder.
Okay!
How about performing this operation:
A USB drive is inserted and the drive name is G:\.I want to copy all the folders except .exe files..and want to do this silently mean without displaying the prompt window.
Should i use @Echo off?
 
I don't think you can make the operation entirely invisible. I think you'll still have a blank window popup at best.

http://www.computerhope.com/echohlp.htm

You can turn command echo off but you'll need to redirect command error messages and output to file or to nul.
 
  • Like
Likes Dave Ritche
I'd write a perl script. Use the File:Copy package.
 
  • Like
Likes Silicon Waffle
  • #10
Dave Ritche said:
Okay!
How about performing this operation:
A USB drive is inserted and the drive name is G:\.I want to copy all the folders except .exe files..and want to do this silently mean without displaying the prompt window.
Should i use @Echo off?
You can also use Windows's vb script .
JavaScript:
::file copy
@echo off
/min
set command=xcopy /s /c /d /e /h /i /r /y /exclude:YourExcludedExeFiles.txt
echo off
%command% "%G%" "%DestinationDrive%"
@echo off
Run your wscript to createObject without arguments e.g
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
and feed its second parameter with the above script file.

If you need this process to run automatically when the USB is inserted, I guess you would probably need to add an autoconf file also for the task.
 
  • #11
Silicon Waffle said:
You can also use Windows's vb script .
JavaScript:
::file copy
@echo off
/min
set command=xcopy /s /c /d /e /h /i /r /y /exclude:YourExcludedExeFiles.txt
echo off
%command% "%G%" "%DestinationDrive%"
@echo off
Run your wscript to createObject without arguments e.g
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
and feed its second parameter with the above script file.

If you need this process to run automatically when the USB is inserted, I guess you would probably need to add an autoconf file also for the task.
Thanks.
I don't know much about Javascript..can you explain a bit about the commands and code you used?
 
  • #12
Dave Ritche said:
Thanks.
I don't know much about Javascript..can you explain a bit about the commands and code you used?

:: <<< is for comment
/min <<< always minimize executed console/windows
set command=xxx <<<< set label 'command'
/exclude:xxx.txt <<<< exclude option for all filenames written in xxx.txt
%command%"%G%""%DestinationDrive%" <<< execute the set command
echo off <<< no output, keep things silent please
 
Last edited:
  • #13
Silicon Waffle said:
You can also use Windows's vb script .
Is it Visual Basic, or Javascript?
 
  • #14
meBigGuy said:
Is it Visual Basic, or Javascript?
It's VB script. That will also help to get things in the storage transferred :wink: ...intentionally.
 
  • #15
The OP saw the Javascript fomated code window and assumed it is Javascript. Just trying to point that out.

If a perl script is desired, I can supply an example. But, I need a requirement for how the script will be invoked.
For example, how does the program know what drive letter to copy. Let's call the command program dumpIt. Would the user type dumpIt G: in a command window?
Or, do you need DumpIt to appear as a right mouse context for any file on the drive? Or, is dumpIt a right mouse context for the drive? Or, do we try to register a service that will run dumpIt on any USB drive placed on the computer? (not sure how to do that one)
 
Back
Top