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

Shell.Application

Status
Not open for further replies.

purepest

Technical User
Jun 22, 2004
118
GB
Hi

From a previous post, where I was looking for a way to show a progress bar, I learned that you can use shell.application then copyhere and you will see the work being done.

Can anyone tell me if it is possible to do the same thing but delete files instead?

Thanks
Colin
 
Hello purepest,

Something like this.
Code:
filepath="d:\test"
filename="abc.def"

set oshns=createobject("shell.application").namespace(filepath)
oshns.items.item(filename).invokeverb "&Delete"  'heavily localized
set oshns=nothing
regards - tsuji
 
Hi
thanks for that.

Unfortunately I have to delete all files from specific folders on remote servers.

I tried it with *.* in the filename but got shown an object required error.

Any ideas?

Colin
 
purepest,

Try this.
Code:
filepath="\\server\test"

set oshns=createobject("shell.application").namespace(filepath)
for each oitem in oshns.items
    oitem.invokeverb "&Delete"  'heavily localized
next
set oshns=nothing
- tsuji
 
Great

One last thing though. This is to delete badmail from the exchange servers in my orginisation.

On the bridghead servers there are thousands of files. Is there any way to delete with out prompting?

Thanks
Colin
 
purepest,

Why do you use shell at all? Is there anything holding you back from using fso? To delete mails from public store, personal mailbox etc, do the thing with the proper tools-the shell is not in any case.

- tsuji
 
tsuli

I know what your saying. I have a script that does the job but I was getting complaints about people not having any indication whether the script was doing anything or not.

Didn't go down well when I suggested opening task manager and looking for wscript.exe ^_^

When I used the shell for a copy file operation I liked the progress bar, thats all.

~CY~
 
There are several ways to display progress bars during vbscript operations. Search this forum for 'progress bar' and you will find many ways to accomplish this.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top