File Deletions

(imported topic written by reuas_gis91)

Hello,

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?

Thanks,

er

(imported comment written by BenKus)

Remember that the agent runs as the SYSTEM account and so the “%username%” will be the system account…

Try this:

dos del /F /S/Q “c:\Documents and Settings{name of current user}”

Or better yet:

waithidden cmd.exe /C del /F /S/Q “c:\Documents and Settings{name of current user}”

Ben

(imported comment written by Steve91)

Hi

I had a similar need recently.

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.

You need to use RMDIR to remove the folder.

Cheers

Steve

(imported comment written by cstoneba)

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.

(imported comment written by jessewk)

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.

(imported comment written by reuas_gis91)

Thank you for all your help.

I will work with both action scripts provided.

I also forgot to add; that I am a newbie member to Big Fix and these forums.

(imported comment written by reuas_gis91)

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”))}

appendfile exit

thanks,

(imported comment written by NoahSalzman)

Why not use the RMDIR /S /Q method described by Steve above? That DOS command will remove both the folder and its contents.

(imported comment written by reuas_gis91)

noah

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.