I have no idea if this is possible or not, and if so where to actually start doing so.
Effectively we have an SFTP server, and I'd like to be able to Archive off the files after they have been downloaded. The Server has multiple rooted users, so I'd need to create a process that can repeat itself across each User's root folder.
Each user does, however, have their folder in the same initial directory (not home), and each has the same file structure afterwards (with an In, Out, and Archive folder).
Is a there a way to achieve this? I did wonder about have a cron task running at say the end of each day, but if so, I would like to handle to unlikely event of the file being overwritten post download. For example, if someone obtained a file from us, and then contacted us to advise that something needed to be amended. The file would then need to be saved in the Out Folder again, but there would be little way I could guarantee that the staff member did not overwrite the previously downloaded file, rather than Suffixing it with something like "v2".
I'm not sure how to achieve to know that the file was downloaded. Are you able to have an event run when a file is accessed on Ubuntu, or by a specific user?
If not, i could check the logs, which would help, which I would show a list of what files have been accessed, however, the logs don't give the year. Considering that this is going to be an on going solution, in 12 months time I don't want the system thinking "this file has been accessed", when what actually happened is a file of the same was access over a year ago.
Anything would need to run server side. Clients will all be external to the company, so I have little to know control over what software, etc, that would use to connect to our server.
It matters if the file is overwritten, as if it's been changed the last thing i want is for the file to be archived. Then the client can't download the updated file. If a new file, with a different name is there, it is clearly a new file.
If you need any specifics (log formats, etc), please let me know.
File Structure (each user has their own folder, so ):
Files that I want to check have been downloaded are in the Out Folder. Files in the In folder don't need to be checked, as this are items we have received, and are archived by a process we already have running when the file is read by our SQL server.
I'm not really looking for someone to give me a full script (Unless you are feeling overly helpful!), but if anyone someone can point me in the right direction and where I might need to start and some snippets of script I might need, that would be extremely useful.
Thanks anyone that can help.