|
script to capture content of deleted file
I need to capture the content of a file before its being deleted. This file gets deleted immediately after it is created.
I use the below shell command in the command prompt, but I'm not getting the desired result.
bash-3.00# while true; do cat file* > tempfile; done;
What I'm trying here is to capture the content of "file*" and output it to tempfile. The content of "file*" gets overwritten in the process and I need to see the latest content.
If I don't try to output it in 'tempfile' I could see the content of the file in the command line -> bash-3.00# while true; do cat file*; done;
Any idea if this can be done in a better way?
|