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.

Hello Rhyan,
In this video I do a lot of stuff with Files:

1:10 Download the file and Move the latest file to folders
4:30 Rename files with VB commands
6:00 Move files to do Rename
6:55 Delete files
8:15 Delete only PNG files
8:55 Delete all the files except PNG files
9:55 Move files
11:10 Delete files that are older than 2 weeks
14:40 Create a file or folder with dates inside
17:00 Trigger a process when the file is added to a folder
18:45 How to use the files start the process
20:30 Excel Application Scope use files

Thanks,
Cristian Negulescu