Deleting a directory and/or files

so i want to build a fixlet that will check to see if a directory/folder exists and if so delete the directory or all the files in it. I need it to pull the name of the user and use that in the delete string, but i can’t figure out how. I have a simple one working one user by using their name in the string. But i’d like it to work with out me having to put the user name, marty, in.

Relevance:

exists folder “C:\Users” AND exists folders whose (exists folder “AppData\Local\GPtest\GlobalProtect” of it) of folder “C:\Users”

Action:

delete “C:\Users\marty\AppData\Local\GPtest\GlobalProtect*."
Or
delete "C:\Users\marty\AppData\Local\GPtest*.

Do you want to delete it from all user profiles, or just a particular profile?
There is not a looping mechanism in action script, but you can build a batch file on-the-fly to emulate a loop. Note “%0d%0a” is the Carriage Return / Line Feed character combination which will split this script into multiple lines and %22 is the doublequote character.
I’m on a phone, not a computer, so test this first without the delete command, just build the batch file and look at it first -

Delete __appendfile
Appendfile {concatenation "%0d%0a" of ("del /q %22" & it & "\Appdata\Local\GPtest\GlobalProtect*.%22") of pathnames of folders of folders "C:\Users"}

Delete cleanup.cmd
Move __appendfile cleanup.cmd
// remove comment from the following line if the batch looks correct

//Waithidden cmd.exe /c cleanup.cmd

Edit: missed closing %22 character

2 Likes