Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbs script help

Status
Not open for further replies.

kedgeboy

Technical User
May 19, 2004
7
GB
Hello

Sorry if this is the wrong forum.

tsuji posted in the Win95/98 forum with a really helpfull script.

You save the vbs into a text file, and when you drag a file into the icon it copies the file to a number of locations set into the array.
Code:
'Edit this input of target folders
aTargetFolder=array( "d:\abc", "d:\def", "d:\ghi")

if wscript.arguments.count=0 then wscript.quit(1)
set fso=createobject("scripting.filesystemobject")
on error resume next
for i=0 to wscript.arguments.count-1
    for j=0 to ubound(aTargetFolder)
        fso.copyfile wscript.arguments(i), fso.getfolder(aTargetFolder(j)).path & "\" & fso.getfilename(wscript.arguments(i)), true
        if err<>0 then
            wscript.echo wscript.arguments(j) & " is not a valid file, or " & aTargetFolder(j) & " is not a valid folder or file cannot be copied to itself. Copy aborted."
            err.clear
        end if
    next
next
wscript.echo "Operation is done."
set fso=nothing
Is it possible to ammend the script to delete the file you drag into the icon in all the locations?

If this is the wrong forum can you point me in the right direction

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top