Recursive delete of some special folders

Discuss RoboTask here
Post Reply
helmkehh
Posts: 1
Joined: Sat Feb 03, 2018 1:29 pm

Recursive delete of some special folders

Post by helmkehh »

Hello,

I have to delete often some folders in the Appdata of all users.
What I have is a script to delete the folders for one user.
But I didn't get it work to do the job for all users :-(
Attached you find the example I wrote.

Can anyone help me what I have to insert to do the job for all users on the machine?

Thank you!

Jan

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task1"
Hide=INTEGER|0
ID=INTEGER|1071804063
LocalVariables=STRING|"FILECOUNT=,FILESIZES=,FILETODELETE="
LogOnAsUser=INTEGER|1
Name=STRING|"Delete 4D AppData"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
UnicodeFormat=INTEGER|0
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action18=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_DIALOG_QUESTION"
Enabled=INTEGER|-1
Name=STRING|"Question Dialog"
Params=FOLDER

[Actions\Action1\Params]
abortif=STRING|"0"
action=STRING|"0"
autotime=STRING|"0"
buttons=STRING|"1"
message=STRING|"""Do you want to delete 4D Appdata files?"""
time=STRING|"60"

[Actions\Action10]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action11]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action11\Params]
message=STRING|"Deleting empty folders"
type=STRING|"3"

[Actions\Action12]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action12\Params]
createmode=STRING|"1"
date1=STRING|"20091201"
date2=STRING|"20091201"
destvar=STRING|"C_FOLDER"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\Users\Jan\AppData\Roaming\4D\*.*"
file1=STRING|"C:\Users\Jan\AppData\Roaming\4D Server\*.*"
file2=STRING|"C:\Users\Jan\AppData\Local\4D\*.*"
file3=STRING|"C:\Users\Jan\AppData\Temp\4D\*.*"
file4=STRING|"C:\Users\Jan\AppData\Temp\4D Server\*.*"
filecount=STRING|"5"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action13]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action13\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{FilesCount({c_folder})}"
value2=STRING|"0"

[Actions\Action14]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action14\Params]
message=STRING|"Removing {c_folder}"
type=STRING|"3"

[Actions\Action15]
ActionID=STRING|"A_FOLDER_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove Empty Folder ({c_folder})"
Params=FOLDER

[Actions\Action15\Params]
deletefolder=STRING|"0"
folder=STRING|"{c_folder}"

[Actions\Action16]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action17]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action18]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action18\Params]
message=STRING|"DONE. {FILECOUNT} files deleted ({FILESIZES} bytes)."
type=STRING|"3"

[Actions\Action2]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action2\Params]
message=STRING|"*********** Start cleaning ***********"
type=STRING|"3"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""FILECOUNT"" with value ""0"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
varname=STRING|"FILECOUNT"
varvalue=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""FILESIZES"" with value ""0"""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"0"
varname=STRING|"FILESIZES"
varvalue=STRING|"0"

[Actions\Action5]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action5\Params]
createmode=STRING|"5"
date1=STRING|"20040614"
date2=STRING|"20040614"
destvar=STRING|"FILETODELETE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
exclude=STRING|"*.4DPreferences"
file0=STRING|"C:\Users\Jan\AppData\Roaming\4D\*.*"
file1=STRING|"C:\Users\Jan\AppData\Roaming\4D Server\*.*"
file2=STRING|"C:\Users\Jan\AppData\Local\4D\*.*"
file3=STRING|"C:\Users\Jan\AppData\Temp\4D\*.*"
file4=STRING|"C:\Users\Jan\AppData\Temp\4D Server\*.*"
filecount=STRING|"5"
OlderDays=STRING|"7"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""FILECOUNT"""
Params=FOLDER

[Actions\Action6\Params]
incement=STRING|"1"
vaiable=STRING|"FILECOUNT"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""FILESIZES"""
Params=FOLDER

[Actions\Action7\Params]
incement=STRING|"{FileSize({FileToDelete})}"
vaiable=STRING|"FILESIZES"

[Actions\Action8]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action8\Params]
message=STRING|"Deleting file {FILETODELETE}"
type=STRING|"3"

[Actions\Action9]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER

[Actions\Action9\Params]
Count=STRING|"1"
deletedirs=STRING|"1"
file0=STRING|"{FileToDelete}"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"0"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_SHEDULER"
Params=FOLDER
UniqueID=INTEGER|-488392018

[Events\Event1\Params]
id=STRING|"UUZWQBPY"
periodicity=STRING|"0"
startdate=STRING|"4294311854"
time0=STRING|"43200000"
time1=STRING|"64800000"
timecount=STRING|"2"

Attachments
Screenshot of task
Screenshot of task
RobotaskTry.png (128.58 KiB) Viewed 6358 times
Post Reply