How can I delete all the documents with 1 week late?

Hi,
I need to know how to do it because I didn’t find something similar.
The steps of the Robot are copy the Excel before interact and then delete this files with one week late.
When the RPA copy the file to another folder, rename that file as: date - time (picture).
I know thta I have to use an if condition and a bucle, but I don’t know how to program the condition of 1 week late with something simlilar at the name of the file.
Thnks.

2022-10-05 12_35_39-986127755 - AnyDesk

Hi
Is the robot planned to execute everyday?
if so, you can add a workflow at the beginning of your process that checks all the files in the directory and deletes the ones that are 7 days old.
To determine the files that are 7 days old, you can use either the name of the file or the creation date of the file.
Let me know if that helps :slight_smile:

Thanks for answering.
First of all, the robot executes Monday to Friday.
Second, I want to use the name of the file because the copys generated are renamed with the date and hour, as you can see in the image.
Finally, the idea that I want to do is a loop with an if condition (the condition of the week) where the files are readed by the bucle and if the rest conditions match with the one week, delete the file. I know the steps to do the loop, the if, and the kill conditions but how can i set the condition of 1 week? If it’s imposible to calculate it doing a rest, ther is another way to do it?
Thanks.

Hi @ShadowZ
FilesFilter.zip (40.3 KB)
Let me know if this helps :slight_smile:

Wow, my congrats, the code is perfect.
You did excatly what I want and that’s amazing because now I can work with the files of other projects and play with the time. 10/10
Thanks :heart:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.