|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBScript - Delete contents of a folder remotely
Hi There,
Well I am making a lab cleanup HTA and am having problems when it comes to a folder that is shared. What I want to is delete all the contents in C:\logs on a remote server. This is the basic concept of what the script does: 1. Maps to the \\Servername\C$ to drive P: 2. Deletes the folder P:\logs 3. Recreate a logs folder The problem is that if the logs folder is shared my script fails. Is there anyway I can delete all the contents of C:\logs without deleting the folder? or any other way that I can delete the shared folder, and when I recreate it share it again..? Thanks in advance Dhruv |
|
#2
|
|||||
|
|||||
|
Try something like this...
vb Code:
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! Last edited by Nilpo : August 24th, 2007 at 07:54 PM. |
|
#3
|
|||
|
|||
|
Thanks for your reply..
I am having problems with the line Set colFiles = objFolder.Files It says it dosent recognize objFolder...I have no idea why.. |
|
#4
|
||||
|
||||
|
Quote:
Set objFolder = objFso.GetFolder("P:\logs") Sorry, had a typo. I've made the change above as well. |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > VBScript - Delete contents of a folder remotely |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|