简体   繁体   中英

Delete a file in linux system after it was read by a process

I'm looking for a solution to monitor a specific directory and delete all files in that directory once they are read (opened and closed) by a process. I'm not interested in monitoring the particular process, but rather the directory itself. What is the most feasible way to achieve this? I'm ok with developing the solution on my own, just need some initial guidelines/ideas.

I think you are looking for something like inotify. https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes have a practical example of what "I think" you are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM