Request help with recording files deleted


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Request help with recording files deleted
# 1  
Old 02-03-2016
Request help with recording files deleted

I am trying to delete files down 2 paths that are older than 5 days old. I would like to keep a record of the files deleted. I have tried to create a job called by cron with the desired output file stated either in the job itself or in the crontab entry.

In the job itself:

Code:
find /archive/inst5/COMMUN/NODE0000/C0000007 -mtime +5 -exec rm {} \; >> /opt/app/ibm/ihome/inst5/logs/logs_deleted.out

find /backup/inst5 -mtime +5 -exec rm {} \; >> /opt/app/ibm/ihome/inst5/logs/bkups_deleted.out

In crontab:

Code:
35 13 * * * . $HOME/.profile >/dev/null 2>&1 ; /opt/app/ibm/ihome/inst11/scripts/prune.sh >> /opt/app/ibm/ihome/inst11/logs/prune.out

However in neither case are the logs being deleted recorded.
Would truly appreciate any suggestions.
Thanks

Last edited by Scrutinizer; 02-03-2016 at 03:37 PM.. Reason: code tags
# 2  
Old 02-03-2016
What OS, find, and rm version do you use?
Does find offer the -delete and/or -ls actions? Does rm have the -v option?
# 3  
Old 02-03-2016
After a silent -exec action you must do an explicit -print action.
Code:
find ... -exec rm {} \; -print ...

(This would also be true with a -delete action.)
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Who deleted my files

Just looking for some guidance on how to figure out who might have deleted some files off one of my systems. These files are not root owned files so could be deleted by a handful of folks in the group responsible for these files besides the root users. Anyway I have been tasked with trying to... (1 Reply)
Discussion started by: juredd1
1 Replies

2. Linux

Need help with deleted files

Hello. I am having a problem and I was wondering if I could get some help from here. I changed into a directory with the cd command and I wanted to delete a folder and all of its subdirectories, so I went ahead and did a rm --recursive * in my current directory to realize that I was in the wrong... (3 Replies)
Discussion started by: jonnydadesigner
3 Replies

3. Shell Programming and Scripting

Need to Recover Deleted Files

Hi, By mistake, executed the following command : rm -rf * and ALL files got deleted. But I need to get back these files as they are very very important. Please help me how to recover this file. Its Urgent for me please. Thanks in advance. (6 Replies)
Discussion started by: unx100
6 Replies

4. UNIX for Advanced & Expert Users

deleted all files - rm *

Hi All, I am using Fedora Core and Windows Xp. I deleted all the files from root directory. When i am trying to restart the computer it showing some grub > prompt. What i will do ? I have lots of data in XP OS. Please help me i used # rm * (8 Replies)
Discussion started by: pritish.sas
8 Replies

5. UNIX for Dummies Questions & Answers

Any way to retrieve deleted files?

:eek: I accidently removed some files using 'rm'. Is there any way to retrieve these files if they were deleted through 'rm'? (1 Reply)
Discussion started by: orahi001
1 Replies

6. Shell Programming and Scripting

Finding deleted files

One of the files got deleted and i want to find who deleted that file. I think we can get the list using history command. Could you please let me know how to get the list of rm commands from history and who previously logged in and did that? Any other suggestions other than history also... (2 Replies)
Discussion started by: Krrishv
2 Replies

7. AIX

recover deleted files

How to recover deleted files in AIX ? (1 Reply)
Discussion started by: vjm
1 Replies

8. UNIX for Dummies Questions & Answers

restoring deleted files

I had a user run, by accident, the following line command on our UNIX server: rm -f /usr/* This apparently deleted some needed files on your system. Having very limited knowledge in UNIX, I thought I would ask the group if anyone knows how I can recover these file? The version of UNIX is... (3 Replies)
Discussion started by: mikem
3 Replies

9. UNIX for Dummies Questions & Answers

Recover deleted files

Is there a Unix tool, like in Novell, to recover accidentally deleted files? (2 Replies)
Discussion started by: kuultak
2 Replies
Login or Register to Ask a Question