How to delete a file by searching folders?

Discuss RoboTask here
Post Reply
anthonyystwarty
Posts: 47
Joined: Fri Dec 30, 2022 2:43 am

How to delete a file by searching folders?

Post by anthonyystwarty »

Hello oleg. as an example I have a file called: test file.mp3, which is located in several subfolders, which task do I use for, look for the test file.mp3 in these folders and delete them? and also using parts of the file name such as: test*.mp3... thank you friend
anthonyystwarty
Posts: 47
Joined: Fri Dec 30, 2022 2:43 am

Re: How to delete a file by searching folders?

Post by anthonyystwarty »

anthonyystwarty wrote: Fri Sep 08, 2023 11:28 pm Hello oleg. as an example I have a file called: test file.mp3, which is located in several subfolders, which task do I use for, look for the test file.mp3 in these folders and delete them? and also using parts of the file name such as: test*.mp3... thank you friend
This doesn't work then
Zac
Posts: 18
Joined: Wed Feb 22, 2023 5:14 pm

Re: How to delete a file by searching folders?

Post by Zac »

Hello, I believe a good solution to this would be to do a File Loop action that uses the file path of the parent file so an example would be "C:\Users\Person\Desktop\Robotask\test file.mp3" and include other iterations of the name as well if there is and in the task do "Assign Current Filename to Variable:" to be a variable. I used "FILENAME" as my variable and select the box "Without Full Path". Also do the look kind "By Files Only". After that, in the file loop add the Delete File Action that uses that File path above but with the variable "FILENAME" at the end so that it changes depending on the name of the file from the file look.
Post Reply