Page 1 of 1

How to delete a file by searching folders?

Posted: Fri Sep 08, 2023 11:28 pm
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

Re: How to delete a file by searching folders?

Posted: Mon Sep 11, 2023 2:33 am
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

Re: How to delete a file by searching folders?

Posted: Thu Nov 09, 2023 11:21 pm
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.