http://www.perlmonks.org?node_id=230304


in reply to How long have you been sitting on my server?

Mr. Muskrat has already answered your question directly, but I hope I can provide some useful ideas:

If your users are technically knowledgeable, you might find they replace the older files with newer files to avoid your 30 day restriction. In this case, you might want to compare the contents of all files within each user's home directory with the contents of all files that were previously there.

You could use Digest::SHA1 or Digest::MD5 as a checksum for the contents of each file, perhaps stored in a DBM database or similar. File::Find::Rule::Digest might help.

  • Comment on Re: How long have you been sitting on my server?

Replies are listed 'Best First'.
Re: Re: How long have you been sitting on my server?
by Anonymous Monk on Jan 27, 2003 at 19:11 UTC
    Mr. Muskrat has already answered your question directly

    mtime and atime do not tell me how long the file has been on the server. ctime or the inode change time represents the time when the file's meta-information last changed. So ctime also doesn't tell me how long the file has been on the server.

    Just thinking off the top of my head here: Could I come up with a script that logs any uploaded file in a database or textfile? The script would have to record the file the instant it gets uploaded. How could I do this if we are using ftp to do the uploading? (This idea isn't perfect, since the user could always rename the file, but whatelse could i do? . . .)

      A simple yet sloppy fix would be to have your script create a .txt file, named the same as you upload file. Since it is created at time of upload have your script check the $mtime of the txt file and if it is 30 days old delete filename.* I like the hash answer much better, though.