Delete file with yesterdays date

I have a file that gets created everyday and goes to the same folder.

I need to have this file deleted before I run any of my other sequences. Just to give a heads up I am an absolute beginner and have no prior coding experience. can someone please help

If you know the path of the file just use the File delete activity at the start of your sequence to clear the directory before you start.

1 Like

Hi @rhyan.brandt ,

can you give more details about your file name and is the folder is also yesterday date?

i assume and giving this.

you can use this activity to delete File. The path you have to give like this.

“c:\users****\downloads”+now.adddays(-1).tostring(“dd-MM-yyy”)+".txt"

in above, file in my downloads folder and the file name format is like 19-07-2019.txt.

now you can change the naming according to your file name.

unsure on how to do this, do i need to do a path exists? if i just try to put in a the directory do i need to put in an asterick for a wild card? i dont wanna delete the whole directory, just the files inside

@rhyan.brandt you can use path exists then followed by a if condition to check if the path exists if exists then delete file using delete Activity else Continue.