'Move File
On Error Resume Next
dim objFSO
dim objFile
'specify filename and path for file to move
strFile="c:\file.txt"
'specify target destination
strDest="c:\Neeraj\"
set objFSO=CreateObject("Scripting.FileSystemObject")
'move will fail if file already exists in target destination
objFSO.MoveFile strFile,strDest
if err.number=0 then
wscript.Echo "Successfully moved " & strFile & " to " & strDest
else
wscript.Echo "Failed to move " & strFile & " to " & strDest
end if
err.Clear
set objFSO=Nothing
On Error Resume Next
dim objFSO
dim objFile
'specify filename and path for file to move
strFile="c:\file.txt"
'specify target destination
strDest="c:\Neeraj\"
set objFSO=CreateObject("Scripting.FileSystemObject")
'move will fail if file already exists in target destination
objFSO.MoveFile strFile,strDest
if err.number=0 then
wscript.Echo "Successfully moved " & strFile & " to " & strDest
else
wscript.Echo "Failed to move " & strFile & " to " & strDest
end if
err.Clear
set objFSO=Nothing
No comments:
Post a Comment