Search for Files --> Exclude folders

Discuss RoboTask here
Post Reply
Rukbunker
Posts: 194
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Search for Files --> Exclude folders

Post by Rukbunker »

Hey Oleg,

With the Search for Files option, we wanted to clean a folder of its contents (including subdirectories), all files older than 1 month. That works ofcourse ;) However, there are 2 subfolders which should not be emptied.

In the "Exclude masks", I've tried to exclude the complete path, the name of the folder, even this method, but it doesn't work.

See screenshot with just 1 example of the exclude which I've tried. The red folders (including files) should be kept, regardless the age of the files. The green ones and the files in the root are allowed to be deleted.
Naamloos.png
Naamloos.png (75.64 KiB) Viewed 597 times
Can you adivse me in this, or....am I missing something?
Last edited by Rukbunker on Fri Apr 12, 2024 8:45 am, edited 1 time in total.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Search for Files --> Exlude folders

Post by Oleg »

...the name of the folder, even this method, but it doesn't work.
Unfortunately Search for Files action has not such mechanism now. I wrote this in our ToDo list.

Now you can solve the problem like in my example (see below)

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1491"
Hide=INTEGER|0
ID=INTEGER|715728214
LogOnAsUser=INTEGER|1
Name=STRING|"List of files without several subfolders"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
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
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Folder"" with value ""c:\temp"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"Folder"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"Folder"
varvalue=STRING|"c:\temp"

[Actions\Action2]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List (variable: List1) //wihout subfolders"
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"List1"
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20240410"
date2=STRING|"20240410"
destvar=STRING|"List1"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{Folder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savetofile=STRING|"0"
savetovar=STRING|"1"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List (variable: List2) //necessary subfolder"
Params=FOLDER

[Actions\Action3\Params]
_rt_variables_produced=STRING|"List2"
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20240410"
date2=STRING|"20240410"
destvar=STRING|"List2"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{Folder}\MP4\*.*"
file1=STRING|"{Folder}\MXF\*.*"
file2=STRING|"{Folder}\SocialMedia\*.*"
filecount=STRING|"3"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savetofile=STRING|"0"
savetovar=STRING|"1"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_STR_TRIM"
Enabled=INTEGER|-1
Name=STRING|"STR Trim"
Params=FOLDER

[Actions\Action4\Params]
_rt_variables_produced=STRING|"List1"
custom=STRING|"0"
eol=STRING|"1"
lead=STRING|"1"
source=STRING|"{List1}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"List1"

[Actions\Action5]
ActionID=STRING|"A_STR_TRIM"
Enabled=INTEGER|-1
Name=STRING|"STR Trim"
Params=FOLDER

[Actions\Action5\Params]
_rt_variables_produced=STRING|"List2"
custom=STRING|"0"
eol=STRING|"1"
lead=STRING|"1"
source=STRING|"{List2}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"List2"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_SHOWTEXT"
Enabled=INTEGER|-1
Name=STRING|"Show Text"
Params=FOLDER

[Actions\Action6\Params]
autoclose=STRING|"0"
fromfile=STRING|"1"
line00000000=STRING|"{List1}"
line00000001=STRING|"{List2}"
linecount=STRING|"2"
timeout=STRING|"10"
Oleg Yershov
Rukbunker
Posts: 194
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Re: Search for Files --> Exclude folders

Post by Rukbunker »

Yupz, it works. Thanks!
Post Reply