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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fancy Shortcuts 3

Status
Not open for further replies.

moldboy

Technical User
Sep 10, 2003
87
I was wondering if there is a way for me to create a shortcut, or simmilar file, that will allow me to drag a file over it and automaticaly have it sent to several diffrent folders? Basicaly I want a shortcut to several diffrent locations a once!!

Thanks in advance
 
Hello moldboy,

This is two-step solution.
[1] Make a script to implement the functionality of copying to multiple locations. For the implementation, I prefer vbscript. But, anything does it will do.
[2] Make a shortcut out of it to the desktop, say.
Now the detail.
[1] The textfile with .vbs extension can be stored to any folder.
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
[2] Make the shortcut
Just make the shortcut sent to the desktop. With the icon, you can drap single or multiple file(s) and drop it/them over the icon.

regards - tsuji

 
Wow...Wow...Wow, and If you don't mind me saying Wow. I can't believe how well it works!!!. If I could star you more than one I would! This script is amazing!!!!!!!!!


Thankyou very very much!
 
I'll star you as well, tsuji, for moldboy's thanks and my own. That's one script I'll have to keep around, just in case. Thanks!
 
Can I also add wow.

Also..

If you copy the shortcut to the following location:

c:\windows\SendTo

When you right click on a file you will have the option (within SendTo) to send the file to the .vbs script.

Does the same as above, except you dont need to drag and drop.
 
Is it possible to adapt that .vbs script to delete the file from all the directories when you drag a file into the shorcut rather than copy?
 
Hello all,

It is a great pleasure to know you like the implementation, and I hope, once you have seen one sample, provide you much motivation to look into an area where you have not a chance or are not motivated to look into. I'm sure you will get much more out of it.

kedgeboy,

Sure, it can be.
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.deletefile fso.getfolder(aTargetFolder(j)).path & "\" & fso.getfilename(wscript.arguments(i)), true
        if err<>0 then
            wscript.echo aTargetFolder(j) & " is not a valid folder or " & fso.getfilename(wscript.arguments(i)) & " does not exist in that folder. File deletion aborted."
            err.clear
        end if
    next
next
wscript.echo "Operation is done."
set fso=nothing
regards - tsuji
 
Thanks for those scripts they will save me loads of time when trying to copy and delete files from our server (we have far too many servers)

I am forever in your debt tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top