I am planning on upgrading some software but I need to delete an old folder from all profiles on a computer. I did a bit of searching through the site and I did find a post on how to list all the user profiles but I would like to know how to incorporate it in the software distribution wizard.
I did try
dos del /F /S/Q “c:\Documents and Settings%username%” but to no avail. The folder was still present. Any tips for this one?
I needed to delete the “Adobe” folder from “Application Data” for all profiles on the PC, might be of use to you…
delete __appendfile
appendfile @echo off
appendfile {("RMDIR /S /Q " & “%22C:\Documents and Settings” & it & “\Application Data\Adobe%22%0d%0a”) of (names of (folders whose (exists folders “Application Data\Adobe” of it) of folder “C:\Documents and Settings”))}
appendfile exit
move __appendfile deladobe.bat
waithidden deladobe.bat
This produces the following output in the batch file:
@echo off
RMDIR /S /Q “C:\Documents and Settings\All Users\Application Data\Adobe”
RMDIR /S /Q “C:\Documents and Settings\g0790524\Application Data\Adobe”
RMDIR /S /Q “C:\Documents and Settings\e2890368\Application Data\Adobe”
exit
Just substitute “Application Data\Adobe” for the name of the folder you want to remove from the profile directories.
This is what I am using to delete the “Applications Data\Citrix\PNAgent” folder:
waithidden cmd.exe /C for /f “usebackq tokens=*” %a in (dir /b /a "c:\documents and settings") do rmdir /s /q “c:\documents and Settings%a\Application Data\Citrix\PNAgent”
This will delete the “Application Data\Citrix\PNAgent” folder from every profile.
In the next release (http://forum.bigfix.com/viewtopic.php?id=3096) we added ‘Folder Create’ and ‘Folder Delete’ commands to the action language which should make these scenarios a little easier in the future.
Sorry for the necro bump. I tried both of these scripts but they fail because the folders are not empty. There’s a lot of .jar files. Can I just edit one of these and do a
.
to delete files?
for example:
appendfile @echo off
appendfile {("DEL /S /Q " & “%22C:\Documents and Settings” & it & “\Application Data\Adobe%22%0d%0a*.*”) of (names of (folders whose (exists folders “Application Data\Adobe” of it) of folder “C:\Documents and Settings”))}
Why not use the RMDIR /S /Q method described by Steve above? That DOS command will remove both the folder and its contents.
For some reason it was not working when I created the job. Then (please hit me with the dumbstick) I noticed that the RMDIR method was in a .bat file. Created that one and it worked. So if you guys have a dumb hammer to bonk me with I’ll appreciate it.