Script Examples vbscript autoit php batch

vbscript - Dateien verschieben (Ersatz für Windows move)

(0)
Artikel
bewerten
(1)

a much better move function then the build in Windows move. This vbscript tries to move each single file / folder. Files or Folders are ignored if they exists on the target

Path = Wscript.Arguments(0)
Path2 = Wscript.Arguments(1)
on error resume next
error = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set Folder = fso.GetFolder(Path)
wscript.echo "move Files and Folders from " & Path & " to " & Path2

'move files
For Each file In Folder.files
wscript.echo file
file2= Path2 & file
fso.MoveFile file,Path2 & "\"
if Err.Number = 0 then
wscript.echo "OK"
else
wscript.echo "error"
error = 1
end if
Next

'move folders:
For Each Folder In Folder.SubFolders
wscript.echo Folder
fso.MoveFolder Folder,Path2 & "\"
if Err.Number = 0 then
wscript.echo "OK"
else
wscript.echo "error"
error = 1
end if
Next

set Folder = nothing: set fso = nothing
    if error = 0 then WScript.Quit(0)
    if error = 1 then WScript.Quit(1)


to start the Script copy the Source in a file for example move.vbs
start the move with: cscript move.vbs source target
download the Script:



move.vbs Größe:(0.78 kB): Download

<<< vbscript um mehrere IP-Adressen bzw ein Subnet zu pingen Outlook per Script Mail versenden >>>


neue Themen

Stichwortsuche auf dieser Seite:
03.09.2010 16:00 zZ 10 Leser online
Powered by cms.libe.net 2004-2010