Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 17th, 2009, 10:42 AM
seblaw seblaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 2 seblaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 5 m 30 sec
Reputation Power: 0
Unhappy WSH - Script required to delete a remote folder's subfolder without deleting the files

Dear Friends

with kind, i request some one to help me to develop my script..

i have 50 machines in WAN network. all are having same username & different password. example - username: admin
password : dt01 , dt02, dt03 etc (note: dt01 is the password for the host dt01 and vice versa..)

i have an application running on all those 50 machines. Normally there is a temporary folders getting created in one of the path. example : \\dt01\c$\documents and settings\all users\application data\cvm\logs
under the above logs folder the temp folders getting created.i need to delete those frequently.but under the LOGS folder there will be some *.txt files aloso there.i dont want delete this files.becos its required file.. now i am doing it manullay.it takes more time. somebody can pls help me to get a script for this..

Reply With Quote
  #2  
Old September 18th, 2009, 01:27 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
If you use the FileSystemObject's Folder object to attach to the Logs folder on each host, it will provide a Files collection and a Subfolders collection. Deleting the items in the Subfolders collection will remove any folders beneath Logs without removing any files in the Logs folder itself.
__________________
Don't like me? Click it.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!

Help us help you! Post your exact error message with these easy tips!

Reply With Quote
  #3  
Old September 20th, 2009, 03:41 AM
seblaw seblaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 2 seblaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 5 m 30 sec
Reputation Power: 0
ha nilpo

currently i am using the following script.but each host i have to edit the script. how can i alter this script to read multiple hosts form a text file. pls help. Also the below script work properly but not giving any result output.

Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder("\\dt01\c$\Documents and Settings\All Users\Application Data\cvm\logs")

arrFolders = Array()
For Each oFolder In oFolder.SubFolders
' Note : Only use *lowercase* letters in the folder names below:
If Not LCase(oFolder.Name) = "foldera" _
And Not LCase(oFolder.Name) = "folderb" _
And Not LCase(oFolder.Name) = "folderc" Then
intCount = UBound(arrFolders) + 1
ReDim Preserve arrFolders(intCount)
arrFolders(intCount) = oFolder.Path
End If
Next

For n = 0 To UBound(arrFolders)
fso.DeleteFolder arrFolders(n), True
Next

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > WSH - Script required to delete a remote folder's subfolder without deleting the files


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek