Login to Website

Login dengan Facebook

 

Post Reply
Thread Tools
  #1  
Old 24th October 2012
Syahrani10's Avatar
Syahrani10
Ceriwiser
 
Join Date: Oct 2012
Posts: 914
Rep Power: 14
Syahrani10 mempunyai hidup yang Normal
Default 1 file copy ke banyak folder VBscript atau BAT jg boleh

izin koreksi master untuk script VBs,BAT,atau apajalah



pertanyaanya ada yg punya resep lebih simple gk ya?



cth1


Code:

mover.vbsSet fso=CreateObject("Scripting.FileSystemObject")
source="d:\path1\"
target="d:\path2\"

Set fldr=fso.getFolder(source)
for each file in fldr.files
if right(lcase(file.name),4)=".pdf" then
call mover(lcase(file.path))
end if
next

sub mover(f1)
f2=replace(f1,"pdf","txt")
if fso.fileExists(f2) then
fso.MoveFile f1,target
fso.MoveFile f2,target
wscript.sleep 60000
end if
end sub

cth2


Code:

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, "C:\DestFolder01\", OverwriteExisting
objFSO.CopyFile Arg, "D:\DestFolder02\", OverwriteExisting
objFSO.CopyFile Arg, "E:\DestFolder03\", OverwriteExisting
objFSO.CopyFile Arg, "F:\DestFolder04\", OverwriteExisting
objFSO.CopyFile Arg, "G:\DestFolder05\", OverwriteExisting

Next
WScript.Quit

contoh lainya dari sini



Sponsored Links
Space available
Post Reply




Switch to Mobile Mode

no new posts