|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Deletion of all Content.IE5 subfolders in all user directories
I am _very_ new to wsh and am trying to create a script that deletes all the content.ie5 subfolders (I am working at a webhost and find myself cleaning gigs off a citrix server by removing these unnessesary files) I was thinking about just using shell scripting to rmdir * everything in in the \Local Settings\Temporary Internet Files\Content.IE5\. I was thinking of using: Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.DeleteFolder("C:\Documents and Settings\*\Local Settings\Temporary Internet Files\Content.IE5\*") but am unsure if the wildcards would work, and also what the entire script would look like.. I tried searching the usegroup to no avail about wildcarding directories or some other method to parse the list of directories and then deleting these large wastes of space. I would just change the size of the temp inet folders, but there are thousands of domains on 10's of thousands of servers and I would shudder at the thought of trying to use the IEAK on all of them :-) any ideas? -JP I guess I could use :
Set FSO = CreateObject("Scripting.FileSystemObject") ShowSubfolders FSO.GetFolder("C:\Documents and Settings") Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders Wscript.Echo Subfolder.Path ShowSubFolders Subfolder Next End Sub but I dont know how to use that to feed in a list to perform the deletions.. -JP I found this scrip via google:
SET SRC1=C:\Documents and Settings SET SRC2=Local Settings\Temporary Internet Files\Content.IE5 FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y" seems to work as far as enumerating and feeding in a list of directories with Content.IE5, and if I take the quotes away from "%%Y" it actually lists the different folders in Content.IE5. I have tried editing this batch file in several probably hillarious ways that I am not willing to post here out of an attempt at preserving what is left of my self image.. any help would be appreciated.. -JP
Show quote
"JP" <J*@discussions.microsoft.com> wrote in message On my computer those folders have the read-only and/or system attribute set. news:D1E619D6-C619-4ABF-9DA6-B56EC84E8EAC@microsoft.com... >I found this scrip via google: > > SET SRC1=C:\Documents and Settings > SET SRC2=Local Settings\Temporary Internet Files\Content.IE5 > > FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S > /Q "%%Y" > > > seems to work as far as enumerating and feeding in a list of directories > with Content.IE5, and if I take the quotes away from "%%Y" it actually > lists > the different folders in Content.IE5. I have tried editing this batch file > in > several probably hillarious ways that I am not willing to post here out of > an > attempt at preserving what is left of my self image.. > > any help would be appreciated.. Try this: FOR /D %%X IN ("%SRC1%\*") DO ( FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO ( attrib -r -h -s "%%Y" RMDIR /S /Q "%%Y" ) ) /Al Hey Al,
Thanks for the reply! Something must be wrong with my laptop.. I keep getting "Parameter format not correct -" errors when I run this script: SET SRC1=C:\Documents and Settings SET SRC2=Local Settings\Temporary Internet Files\Content.IE5 FOR /D %%X IN ("%SRC1%\*") DO ( FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO ( attrib -r -h -s "%%Y" RMDIR /S /Q "%%Y" ) ) C:\Documents and Settings\jupo\Desktop>SET SRC1=C:\Documents and Settings C:\Documents and Settings\jupo\Desktop>SET SRC2=Local Settings\Temporary Internet Files\Content.IE5 C:\Documents and Settings\jupo\Desktop>FOR / %X IN ("C:\Documents and Settings\*") DO (FOR / %Y IN ("%X\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and Settings\All Users\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\EI70WG4K RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\EI70WG4K ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\CDU7KXA7 RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\CDU7KXA7 ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\13P35QF9 RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\13P35QF9 ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\ZTNZEOPS RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\ZTNZEOPS ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\SHYVSXQJ RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\SHYVSXQJ ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\HEKQZHH0 RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\HEKQZHH0 ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\OPAN8TYJ RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\OPAN8TYJ ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>( attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\WRLFAQBH RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\WRLFAQBH ) Parameter format not correct - C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and Settings\user1\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and Settings\fred\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and Settings\bob\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and Settings\Copy of fred\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO ( attrib -r -h -s %Y RMDIR /S /Q %Y ) ) ------------------------------- Grasping at straws, but really apprecative of the help -JP
Show quote
"JP" <J*@discussions.microsoft.com> wrote in message
news:E52C8D44-94B7-4DD7-BBD3-E2BCC672FE1B@microsoft.com... > Hey Al, > > Thanks for the reply! Something must be wrong with my laptop.. I keep > getting "Parameter format not correct -" errors when I run this script: > > > SET SRC1=C:\Documents and Settings > SET SRC2=Local Settings\Temporary Internet Files\Content.IE5 > > > FOR /D %%X IN ("%SRC1%\*") DO ( > FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO ( > attrib -r -h -s "%%Y" > RMDIR /S /Q "%%Y" > ) > ) > > > C:\Documents and Settings\jupo\Desktop>SET SRC1=C:\Documents and Settings > > C:\Documents and Settings\jupo\Desktop>SET SRC2=Local Settings\Temporary > Internet Files\Content.IE5 > > C:\Documents and Settings\jupo\Desktop>FOR / %X IN ("C:\Documents and > Settings\*") DO (FOR / %Y IN ("%X\Local Settings\Temporary Internet > Files\Content.IE5\*.*") DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\All Users\Local Settings\Temporary Internet > Files\Content.IE5\*.*") > DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\Administrator\Local Settings\Temporary Internet > Files\Content.IE5\*.*") DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO > ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\EI70WG4K > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\EI70WG4K > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\CDU7KXA7 > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\CDU7KXA7 > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\13P35QF9 > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\13P35QF9 > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\ZTNZEOPS > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\ZTNZEOPS > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\SHYVSXQJ > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\SHYVSXQJ > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\HEKQZHH0 > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\HEKQZHH0 > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\OPAN8TYJ > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\OPAN8TYJ > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\WRLFAQBH > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\WRLFAQBH > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\user1\Local Settings\Temporary Internet Files\Content.IE5\*.*") > DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\fred\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO > ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\bob\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO > ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\Copy of fred\Local Settings\Temporary Internet > Files\Content.IE5\*.*") DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > ------------------------------- > > > Grasping at straws, but really apprecative of the help > > -JP oops... hit return too soon.
first, you do have sufficient access to change the attributes and also to delete the folder, do you not? second, are you typing the commands in each time, or running them from a batch file? If the former, I'd strongly recommend you put the commands in a batch file (don't forget to double the percent signs on the FOR loop variables), Then you can more easily add other code to help debug the situation, for example: attrib "%%Y" attrib -r -h -s "%%Y" attrib "%%Y" pause /Al Show quote "JP" <J*@discussions.microsoft.com> wrote in message news:E52C8D44-94B7-4DD7-BBD3-E2BCC672FE1B@microsoft.com... > Hey Al, > > Thanks for the reply! Something must be wrong with my laptop.. I keep > getting "Parameter format not correct -" errors when I run this script: > > > SET SRC1=C:\Documents and Settings > SET SRC2=Local Settings\Temporary Internet Files\Content.IE5 > > > FOR /D %%X IN ("%SRC1%\*") DO ( > FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO ( > attrib -r -h -s "%%Y" > RMDIR /S /Q "%%Y" > ) > ) > > > C:\Documents and Settings\jupo\Desktop>SET SRC1=C:\Documents and Settings > > C:\Documents and Settings\jupo\Desktop>SET SRC2=Local Settings\Temporary > Internet Files\Content.IE5 > > C:\Documents and Settings\jupo\Desktop>FOR / %X IN ("C:\Documents and > Settings\*") DO (FOR / %Y IN ("%X\Local Settings\Temporary Internet > Files\Content.IE5\*.*") DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\All Users\Local Settings\Temporary Internet > Files\Content.IE5\*.*") > DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\Administrator\Local Settings\Temporary Internet > Files\Content.IE5\*.*") DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\jupo\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO > ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\EI70WG4K > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\EI70WG4K > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\CDU7KXA7 > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\CDU7KXA7 > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\13P35QF9 > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\13P35QF9 > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\ZTNZEOPS > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\ZTNZEOPS > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\SHYVSXQJ > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\SHYVSXQJ > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\HEKQZHH0 > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\HEKQZHH0 > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\OPAN8TYJ > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\OPAN8TYJ > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>( > attrib -r -h -s C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\WRLFAQBH > RMDIR /S /Q C:\Documents and Settings\jupo\Local Settings\Temporary > Internet Files\Content.IE5\WRLFAQBH > ) > Parameter format not correct - > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\user1\Local Settings\Temporary Internet Files\Content.IE5\*.*") > DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\fred\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO > ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\bob\Local Settings\Temporary Internet Files\Content.IE5\*.*") DO > ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > C:\Documents and Settings\jupo\Desktop>(FOR / %Y IN ("C:\Documents and > Settings\Copy of fred\Local Settings\Temporary Internet > Files\Content.IE5\*.*") DO ( > attrib -r -h -s %Y > RMDIR /S /Q %Y > ) ) > > ------------------------------- > > > Grasping at straws, but really apprecative of the help > > -JP "Al Dunbar" wrote: i have local admin rights> oops... hit return too soon. :-) > first, you do have sufficient access to change the attributes and also to > delete the folder, do you not? > second, are you typing the commands in each time, or running them from a i am running them from a .bat file> batch file? If the former, I'd strongly recommend you put the commands in a > batch file (don't forget to double the percent signs on the FOR loop all the files show up as > variables), Then you can more easily add other code to help debug the > situation, for example: > > attrib "%%Y" > attrib -r -h -s "%%Y" > attrib "%%Y" > pause A C:\Documents and Settings\bob\LocalSettings\Temporary Internet Files\ Content.IE5\CDU7KXA7\mail[9] A C:\Documents and Settings\bob\LocalSettings\Temporary Internet Files\ Content.IE5\CDU7KXA7\mail[17] A C:\Documents and Settings\bob\LocalSettings\Temporary Internet Files\ so i dont think that is the issue. thanks again, -jP
Show quote
"Al Dunbar" wrote: Hey again,> oops... hit return too soon. > > first, you do have sufficient access to change the attributes and also to > delete the folder, do you not? > > second, are you typing the commands in each time, or running them from a > batch file? If the former, I'd strongly recommend you put the commands in a > batch file (don't forget to double the percent signs on the FOR loop > variables), Then you can more easily add other code to help debug the > situation, for example: > > attrib "%%Y" > attrib -r -h -s "%%Y" > attrib "%%Y" > pause > > > /Al I have admin rights and am running it from a .bat file. I am going to run the script |
|||||||||||||||||||||||