troubleshooting Question

Delete files on ftp server

Avatar of ocamporuss
ocamporuss asked on
Visual Basic.NET
7 Comments3 Solutions431 ViewsLast Modified:
Greetings,

I have created a program using vb.net which allows users to upload files on an ftp server and share them via a link that the program generates at the end of the upload.

To save space on my ftp server, I will only be keeping the uploaded files for a set time (in this case 7 days) and would delete files older than that.

For that I am creating a separate program (still using vb.net) that will run unattended on my PC. I am aiming for this to check the ftp server every now and then, check all existing files at that moment and see if they are 7 days or older then delete such files.

Unfortunately, I cannot seem to find a way to "detect" the date the file was uploaded (modified date) and run a procedure to check if it is already more than 7 days old.

I have used the function WebRequestMethods.Ftp.ListDirectoryDetails but it returns strings which I have no way of isolating the file date (and it also does not provide the year, which would be a problem to compute how old the file is if it was uploaded towards the end of the year)

Any suggestions on how I can get about deleting files on my ftp server that are a certain amount of days old?

Thank you and regards.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros