Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thank you for the best reply I've ever had to a forum question - it's extremely comprehensive and legible and answers my query thoroughly..."

Geography

Where in the world do Tek-Tips members come from?
ksdh (TechnicalUser)
10 Mar 09 10:44
Hi
I have a directory with hundreds of files.
I would like to delete files older than a day. How could i do this?

Would mtime work?

Thanks
PHV (MIS)
10 Mar 09 12:12
motoslide (MIS)
10 Mar 09 15:46
How about making that:
find /path/to/dir -type f -mtime +1|xargs rm

 

"Proof that there is intelligent life in Oregon.  Well, Life anyway."

PHV (MIS)
11 Mar 09 4:02
OOps, good catch motoslide, I've inverted the test.
stefanwagner (Programmer)
16 Mar 09 21:36
Useless use of xargs.

CODE

find /path/to/dir -type f -mtime +1 -delete
 

don't visit my homepage: http://home.arcor.de/hirnstrom/minis/index.html

KenCunningham (TechnicalUser)
17 Mar 09 5:21
Which flavour of find is that Stefan?

I want to be good, is that not enough?

feherke (Programmer)
17 Mar 09 5:31
Hi

Doh, I would loose. My bet was that PHV will post that question. winky smile

( Is available in GNU find since version 4.2.3, implemented on 2004-10-30. )

Feherke.
http://rootshell.be/~feherke/

KenCunningham (TechnicalUser)
17 Mar 09 5:50
Had a feeling it might have been, Feherke!

I want to be good, is that not enough?

stefanwagner (Programmer)
17 Mar 09 18:03
Ah - not in the Gnu/Linux-Server/Client-section?

GNU-find on Linux, Version 4.2.32.
 

don't visit my homepage: http://home.arcor.de/hirnstrom/minis/index.html

razalas (Programmer)
17 Mar 09 22:16
There is always -exec

CODE

find /path/to/dir -type f -mtime +1 -exec rm {} \;

Code what you mean,
and mean what you code!
But by all means post your code!

Razalas

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close