stevemarks59
Technical User
How can the script below be modified so when a folder is copied to the
destination and a folder exits there with the same name, it will completely REPLACE the old folder
instead of merging with it and only overwriting files with the same name?
----------------------------------------------------------------------------
On Error Resume Next
Const OverwriteExisting = True
Set objArgs = WScript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objArgs.Count < 1 Then
MsgBox "Thanks but.. Wrong!!" & vbCRLF & _
"" & vbCRLF & _
"Select a file in Explorer, drag and drop it on the script." & vbCRLF & _
"Or place a shortcut from the script into the SendTo folder" & vbCRLF & _
"This way the script will show in the sendto right click menu ." & vbCRLF & _
"" & vbCRLF & _
"To edit the sendto menu go to 'Start - Run - Sendto - OK" & vbCRLF & _
"Place the shortcut from DropFile.vbs in the SendTo folder, now right click a file and 'Send To'DropFile", _
vbInformation + vbOKOnly, Title
WScript.Quit
End If
For I = 0 to objArgs.Count - 1
Arg = objArgs(I)
objFSO.CopyFile Arg, "D:\SAVED\", OverwriteExisting
objFSO.CopyFile Arg, "D:\SAVED\", OverwriteExisting
Next
WScript.Quit
------------------------------------------------------------------
destination and a folder exits there with the same name, it will completely REPLACE the old folder
instead of merging with it and only overwriting files with the same name?
----------------------------------------------------------------------------
On Error Resume Next
Const OverwriteExisting = True
Set objArgs = WScript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objArgs.Count < 1 Then
MsgBox "Thanks but.. Wrong!!" & vbCRLF & _
"" & vbCRLF & _
"Select a file in Explorer, drag and drop it on the script." & vbCRLF & _
"Or place a shortcut from the script into the SendTo folder" & vbCRLF & _
"This way the script will show in the sendto right click menu ." & vbCRLF & _
"" & vbCRLF & _
"To edit the sendto menu go to 'Start - Run - Sendto - OK" & vbCRLF & _
"Place the shortcut from DropFile.vbs in the SendTo folder, now right click a file and 'Send To'DropFile", _
vbInformation + vbOKOnly, Title
WScript.Quit
End If
For I = 0 to objArgs.Count - 1
Arg = objArgs(I)
objFSO.CopyFile Arg, "D:\SAVED\", OverwriteExisting
objFSO.CopyFile Arg, "D:\SAVED\", OverwriteExisting
Next
WScript.Quit
------------------------------------------------------------------