Page 1 of 1
Delete all files from a folder that is located in multiple locations? One Command
Posted: Tue Sep 24, 2024 3:26 pm
by anthonyystwarty
Hi Olleg, Congratulations.
Is there any way to delete all files from a folder that is located in multiple locations?
With just one command? For example:
C:\Test\Pictures\Temp\image.jpg
C:\Test\Videos\Temp\heart.mpg
C:\Test\Windows\Temp\audio.mp3
How can I delete only the files from the temp folder, with just one command?
Re: Delete all files from a folder that is located in multiple locations? One Command
Posted: Tue Sep 24, 2024 5:35 pm
by felipe
You can add multiple folder and file, it will create a directory list

- delet.jpg (30.7 KiB) Viewed 66209 times
Re: Delete all files from a folder that is located in multiple locations? One Command
Posted: Wed Sep 25, 2024 3:11 am
by anthonyystwarty
Thanks for the answer, yes, I use this, but I would like to not need to add all the folders to be deleted, I need something like a command that searches all the \Temp folders that are in C:\ and deletes all the files.
Congratulations
Re: Delete all files from a folder that is located in multiple locations? One Command
Posted: Wed Sep 25, 2024 7:09 am
by Oleg
I need something like a command that searches all the \Temp folders that are in C:\ and deletes all the files.
In this case you must search all folders named
Temp in the
File Loop.
Use "By folders only" option.
And delete the necessary files inside the loop in every folder you find.
Re: Delete all files from a folder that is located in multiple locations? One Command
Posted: Tue Oct 01, 2024 3:56 pm
by anthonyystwarty
Hello Oleg, How are you? Unfortunately I couldn't do it, because I didn't understand how it works due to my language, could you help me?
Does Fileloop delete files? Sorry for the inconvenience.
Re: Delete all files from a folder that is located in multiple locations? One Command
Posted: Thu Oct 03, 2024 6:43 am
by Oleg
Look at this 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.
then you can see in in task editor
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1075658632
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1455"
Hide=INTEGER|0
ID=INTEGER|-1167522676
LogOnAsUser=INTEGER|1
Name=STRING|"Remove files in TEMP 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
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""StartFolder"" with value ""C:\test"""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"StartFolder"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"StartFolder"
varvalue=STRING|"C:\test"
[Actions\Action2]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop // Looking for TEMP subfolders"
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"FolderToClear"
createmode=STRING|"1"
date1=STRING|"20241003"
date2=STRING|"20241003"
destvar=STRING|"FolderToClear"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{StartFolder}\temp"
filecount=STRING|"1"
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|"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|"clear folder {FolderToClear}"
type=STRING|"3"
[Actions\Action4]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File // delete file in TEMP subfolder"
Params=FOLDER
[Actions\Action4\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
deletereadonly=STRING|"0"
file0=STRING|"{FolderToClear}\*.*"
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"
The task searches for
TEMP subfolders in some
StartFolder folder and deletes files in the found folder.
Re: Delete all files from a folder that is located in multiple locations? One Command
Posted: Fri Oct 04, 2024 5:35 am
by anthonyystwarty
Thanks a lot for your assistance, you're always so helpful! The command worked now, that’s exactly what I needed!
Re: Delete all files from a folder that is located in multiple locations? One Command
Posted: Thu Jan 02, 2025 5:39 am
by ColeHarry
Thank you for giving us that experience. We hope you will share more with us!