Click here to Skip to main content
Licence 
First Posted 24 May 2004
Views 30,216
Bookmarked 11 times

FTP search of older files and delete them

By | 24 May 2004 | Article
Mark all the files on an FTP site that are older than a specified time and delete if required.

Sample Image - Ftp_Clearer.jpg

Introduction

This utility allows one to mark all the files on an FTP site that are older than a specified time. The user may then choose to delete those files/dirs.

Code references

I have used:

  1. The FTP library provided by http://www.enterprisedt.com/.
  2. Code to parse the file info returned by the FTP site. (I tried to find out where I got that code from and found the same code at different places. So I will just put this note here that the ParseDosDirLine and ParseUnixDirLine is not my code.)

Usage

  1. To preconfigure your servers, add the server/user/password in the options.xml file.
  2. Start the program.
  3. Set the 'Time before now' value as required.
  4. Choose to "Check directories" if you want the date of the directories also to be checked.
  5. Enter any comma separated strings in "Ignore Dirs with substring" if you do not want to scan directories that contain the specified substring.
  6. Click Scan.

Known issues:

  1. The program runs in a single thread and it might seem dead while the FTP site is being scanned.
  2. If there is an FTP error, the scan has to be restarted. Not much error checking and recovery is being done.

This is a quickly put together piece of code that could have a whole lot of functionality added. Feel free to make changes and post the code.

Suggested improvements

  1. Make the program multithreaded, and responsive to a possible 'Cancel' by the user.
  2. Add additional 'Check' criteria like file size, file name, file type, etc.
  3. Recover well from FTP failures and restart from the point of failure.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

SathishVJ



France France

Member

~/sathishvj

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralUpdated Parsing Code Pinmembermuamw105:53 5 Mar '07  
GeneralRe: Updated Parsing Code PinmemberhannesHTG21:40 27 May '09  
GeneralFTP And SQL Help PinmemberWaqasButt0:58 24 Dec '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 25 May 2004
Article Copyright 2004 by SathishVJ
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid