How can I remove a file by searching folders?
-
- Posts: 1
- Joined: Sat Jan 11, 2025 2:59 am
How can I remove a file by searching folders?
Hello, oleg. For example, suppose I have a file named test file.mp3 that is placed in various subfolders; which task should I use to hunt for and remove the test file.mp3 in these folders? Also utilizing sections of the file name such as: test*.mp3... thank you, pal.
Re: How can I remove a file by searching folders?
You can remove files in subfolders in the File Loopsuppose I have a file named test file.mp3 that is placed in various subfolders; which task should I use to hunt for and remove the test file.mp3 in these folders?
Look at my example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|45174721
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1470"
Hide=INTEGER|0
ID=INTEGER|1627463825
LogOnAsUser=INTEGER|1
Name=STRING|"delete file in subfolders"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SearchFile"" with value ""D:\incoming\test\test.txt"""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"SearchFile"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"SearchFile"
varvalue=STRING|"D:\incoming\test\test.txt"
[Actions\Action2]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"filename"
createmode=STRING|"1"
date1=STRING|"20250111"
date2=STRING|"20250111"
destvar=STRING|"filename"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{SearchFile}"
filecount=STRING|"1"
OlderDays=STRING|"1"
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\Action3]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action3\Params]
message=STRING|"removing file ""{filename}"""
type=STRING|"3"
[Actions\Action4]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER
[Actions\Action4\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
deletereadonly=STRING|"0"
file0=STRING|"{filename}"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
You can also use a file mask with no problemAlso utilizing sections of the file name such as: test*.mp3
Oleg Yershov