LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-22-2010, 02:25 AM   #16
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405

Quote:
Originally Posted by dsoria View Post
Hello

im new..

regars to all
Don't post in an old thread if you do not have anything substantial to add or have a related question. LinuxQuestions.org Member Intro is a good place to introduce yourself and get your first post.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-13-2011, 10:15 AM   #17
Dirty
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
Hello all. Great thread so far, really helpful. I do have a question though.

I want to take this script
Code:
#!/bin/bash

/usr/bin/find /insert/path/here -mtime +3 -exec rm {} \;
and add logging to it.

I want to see if there is a way to get a list of what is found before it's deleted, and after it's deleted. I know there is a verbose option for rm, but I can't seem to find one for find. Any help would be greatly appreciated.

Thanks in advance!
 
Old 04-13-2011, 11:31 PM   #18
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Please don't necro-post ie dig up threads so old. Instead, start a new thread.
Thank you.

In brief, find doesn't have a logging option; one approach is to use -print (instead of -exec rm ...) at the end of a copy of the same find cmd and re-direct to a file, then run the find ... rm version.
 
Old 04-14-2011, 11:07 PM   #19
Dirty
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
After reading the thread, and particularly post 16, I figured it was a safe bump. I would've linked to this thread anyway as a reference, because people would've told me to "Search n00b" anyway. Anyway, thanks for the info.
 
Old 05-31-2011, 05:06 AM   #20
fredie_barron
LQ Newbie
 
Registered: Mar 2011
Posts: 5

Rep: Reputation: 0
find /path/dir -mtime +30 -delete
this is not working for me.
 
Old 05-31-2011, 06:55 AM   #21
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by chrism01 View Post
Please don't necro-post ie dig up threads so old. Instead, start a new thread.
Thank you.

In brief, find doesn't have a logging option; one approach is to use -print (instead of -exec rm ...) at the end of a copy of the same find cmd and re-direct to a file, then run the find ... rm version.
There is a way to run 'find' only once if use 'exec' to redirect:
Code:
exec 3>&1 1>/path/to/logfile ; find . -print -delete ; exec 1>&3
or as a subshell version:
Code:
( exec 1>/path/to/logfile ; find . -print -delete )
 
Old 03-04-2012, 02:58 AM   #22
azvampyre
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by druuna View Post
Don't post in an old thread if you do not have anything substantial to add or have a related question. LinuxQuestions.org Member Intro is a good place to introduce yourself and get your first post.
I'm posting in an old thread!

It's quite easy to tell who sits on their fat butt on a computer all day and who works in construction by the way some of you jerks act towards others on the internet.
If people aren't supposed to post in "an old thread", then it needs to be removed from the sitemap.xml instead of being refreshed every week for Google to keep on the first page of search so if you have a problem, take it up with the Admin who could have easily removed this page from the sitemap long ago.

You had a "newbie" introducing themselves and for that you have to act like a total bloke?

Hello dsoria. I'm azvampyre, and I'm a building contractor who works for a living, but like to program in my sparsely spare time.
Do you see how much friendlier people who work out in the nice sunlight are towards others, drunna? Maybe you should get some sun and "lighten up". I'm sorry you're fat and pale, but don't take it out on the innocent, okay.
 
Old 03-04-2012, 03:22 AM   #23
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by azvampyre View Post
I'm posting in an old thread!
Yes you are, and that is against the LQ Rules.

Quote:
It's quite easy to tell who sits on their fat butt on a computer all day and who works in construction by the way some of you jerks act towards others on the internet.
If people aren't supposed to post in "an old thread", then it needs to be removed from the sitemap.xml instead of being refreshed every week for Google to keep on the first page of search so if you have a problem, take it up with the Admin who could have easily removed this page from the sitemap long ago.
No need to be condescending. It seems I'm not the one that has a problem, you seem to have one. Take your own advise and contact the LQ site owner if you want to address your issues related to LQ.

Quote:
You had a "newbie" introducing themselves and for that you have to act like a total bloke?
Yes I pointed out that digging up old threads just to introduce oneself isn't the correct thing to do (it is actually against the LQ rules). I also pointed out that there is a specific sub-forum for people that want to introduce themselves.

Quote:
Hello dsoria. I'm azvampyre, and I'm a building contractor who works for a living, but like to program in my sparsely spare time.
Do you see how much friendlier people who work out in the nice sunlight are towards others, drunna? Maybe you should get some sun and "lighten up". I'm sorry you're fat and pale, but don't take it out on the innocent, okay.
Again: Don't be so condescending (and learn to spell)

BTW: Reported.
 
Old 03-04-2012, 06:05 AM   #24
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by azvampyre View Post
...

Do you see how much friendlier people who work out in the nice sunlight are towards others, drunna? Maybe you should get some sun and "lighten up". I'm sorry you're fat and pale, but don't take it out on the innocent, okay.
I need to reply to this insults

azvampyre
I think your kind of breed needs to be investigated further, as I don't know of an individual that can walk out on the sun wihtout any protection. Do you have it?

My best Regards to all LQ
 
Old 03-04-2012, 06:35 AM   #25
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by azvampyre View Post
I'm posting in an old thread!

It's quite easy to tell who sits on their fat butt on a computer all day and who works in construction by the way some of you jerks act towards others on the internet.
If people aren't supposed to post in "an old thread", then it needs to be removed from the sitemap.xml instead of being refreshed every week for Google to keep on the first page of search so if you have a problem, take it up with the Admin who could have easily removed this page from the sitemap long ago.

You had a "newbie" introducing themselves and for that you have to act like a total bloke?

Hello dsoria. I'm azvampyre, and I'm a building contractor who works for a living, but like to program in my sparsely spare time.
Do you see how much friendlier people who work out in the nice sunlight are towards others, drunna? Maybe you should get some sun and "lighten up". I'm sorry you're fat and pale, but don't take it out on the innocent, okay.
Hm, I have known people who work on construction and others who sit on their butt all day. I can assure you that there are "jerks" on both sides.

Judging on who is a "jerk" and who is not by the work they do is a rather simple-minded point of view.
 
Old 03-04-2012, 08:22 AM   #26
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator response

Hi,

Quote:
Originally Posted by azvampyre View Post
I'm posting in an old thread!

It's quite easy to tell who sits on their fat butt on a computer all day and who works in construction by the way some of you jerks act towards others on the internet.
If people aren't supposed to post in "an old thread", then it needs to be removed from the sitemap.xml instead of being refreshed every week for Google to keep on the first page of search so if you have a problem, take it up with the Admin who could have easily removed this page from the sitemap long ago.

You had a "newbie" introducing themselves and for that you have to act like a total bloke?

Hello dsoria. I'm azvampyre, and I'm a building contractor who works for a living, but like to program in my sparsely spare time.
Do you see how much friendlier people who work out in the nice sunlight are towards others, drunna? Maybe you should get some sun and "lighten up". I'm sorry you're fat and pale, but don't take it out on the innocent, okay.
Enough!
Quote:
LQ Rules
By becoming a member you agreed to adhere to these guidelines. These guidelines are subject to change and a current version is always available in the forums. If you come across any violations to these guidelines or have any problems navigating the site, do not hesitate to let us know via email or the forums.
LQ is a moderated forum and members do help by providing insight to new users.
There is no need for personal attacks;
Quote:
Personal attacks on others will not be tolerated.
druuna's post to a newbie was not in violation. Your responding post to a nearly two year old post is not warranted nor should you have posted. If you felt that a post warrants moderation then please report that post. Your tirade and personal attacks are something we will not tolerate. Please review the LQ Rules!

My suggestion to you is to tone it down;
Quote:
Challenge others' points of view and opinions, but do so respectfully and thoughtfully ... without insult and personal attack. Differing opinions is one of the things that make this site great.
As to your references to sitemap retention, I suggest that you open a new thread in LQ Suggestions & Feedback for topics that you think need improvement, attention or revision(s).

If you have any questions then feel free to contact me personally via PM/email.

To everyone: No further posting of non related topics in this thread!

Back on topic!

Last edited by onebuck; 03-04-2012 at 05:21 PM. Reason: typo
 
Old 10-04-2012, 08:26 AM   #27
Blackbit
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
Smile Reporting deletions

Quote:
Originally Posted by Dirty View Post
Hello all. Great thread so far, really helpful. I do have a question though.

I want to take this script
Code:
#!/bin/bash

/usr/bin/find /insert/path/here -mtime +3 -exec rm {} \;
and add logging to it.
There is an easy way to do that. find allows multiple usage of exec like this:

Code:
find /home/backup/ -type f -exec echo Removing old backup: {} \; -exec rm {} \;
Another idea is to tell rm to report any deletions with -v:

Code:
find /home/backup/ -type f -exec rm -v {} \;
I prefer the first method, as the text is easier to change.

btw.: The parameter "-delete" is not available for all versions of find, but rm should be ;-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating age in days and month in a bash script jachba Programming 5 06-23-2006 01:37 PM
delete files older than 30 days using cronjob latheesan Linux - Newbie 5 06-14-2005 02:40 PM
delete files in server that is older than 30 days using cronjob latheesan *BSD 2 06-14-2005 12:37 PM
help with a script that deletes files more than X days old BrianK Linux - General 5 06-14-2004 09:05 PM
Tar files in a dir modified before 7 days in a shell script jayachristina Linux - Newbie 4 05-14-2004 02:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration