How do you do....it? Thread, Proper syntax to delete folder from Multiple Profiles in Technical; Does anyone know what Syntax is needed to delete a certain folder from every profile on a machine. exp.
' ...
-
3rd June 2008, 12:24 PM #1
- Rep Power
- 0
Proper syntax to delete folder from Multiple Profiles
Does anyone know what Syntax is needed to delete a certain folder from every profile on a machine. exp.
' ------ SCRIPT CONFIGURATION ------
strFolderPath = "<FolderPath>" ' e.g. "d:\temp"
' ------ END CONFIGURATION ---------
set objFSO = CreateObject("Scripting.FileSystemObject")
ObjFSO.DeleteFolder("C:\Documents and Settings\qt34064\Documentum\UCF")
WScript.Echo "Successfully deleted folder"
I want to remove it from Qt34065, Qt23404 and so on. How can I edit this in order for this to happen?
Thx
-
-
IDG Tech News
-
3rd June 2008, 01:17 PM #2 I'm guessing you're trying to delete the folder "documentum" and everything under it that's in any user profile folder on the machine?
If so then this should work:
Code:
set ofso=createobject("scripting.filesystemobject")
sRoot="c:\documents and settings\"
sFolder="documentum"
set oFolder=ofso.getfolder(sRoot)
for each oSubFolder in oFolder.subfolders
sName=sRoot & oSubFolder.name & "\" & sFolder
if ofso.folderexists(sName) then
'wscript.echo sName
ofso.deletefolder(sRoot & sName & "\" & sFolder,true)
end if
next the wscript.echo line is for testing; what I do with something like this is to leave in the echo line but comment out the delete line - that way I can see what folders are going to be deleted before it all goes horribly wrong :-)
When you are sure you're working with the right set of folders then you can comment out the echo line and uncomment the delete line.
-
Thanks to srochford from:
-
3rd June 2008, 02:54 PM #3
- Rep Power
- 0
I'm trying to delete the UCF directory under Documentum for every profile, so can I just change the sFolder= to UCF instead of Documentum?

Originally Posted by
srochford
I'm guessing you're trying to delete the folder "documentum" and everything under it that's in any user profile folder on the machine?
If so then this should work:
Code:
set ofso=createobject("scripting.filesystemobject")
sRoot="c:\documents and settings\"
sFolder="documentum"
set oFolder=ofso.getfolder(sRoot)
for each oSubFolder in oFolder.subfolders
sName=sRoot & oSubFolder.name & "\" & sFolder
if ofso.folderexists(sName) then
'wscript.echo sName
ofso.deletefolder(sRoot & sName & "\" & sFolder,true)
end if
next the wscript.echo line is for testing; what I do with something like this is to leave in the echo line but comment out the delete line - that way I can see what folders are going to be deleted before it all goes horribly wrong :-)
When you are sure you're working with the right set of folders then you can comment out the echo line and uncomment the delete line.
-
SHARE: 
Similar Threads
-
By chrbb in forum Scripts
Replies: 4
Last Post: 4th February 2010, 05:15 PM
-
By JPhillips173 in forum Scripts
Replies: 2
Last Post: 17th April 2008, 11:25 AM
-
By Simcfc73 in forum Windows
Replies: 3
Last Post: 15th January 2008, 06:29 PM
-
By timbo343 in forum Scripts
Replies: 15
Last Post: 19th September 2007, 10:46 PM
-
Replies: 17
Last Post: 14th October 2006, 08:20 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules