Mar 10, 2009 #1 ksdh Technical User Joined Oct 24, 2007 Messages 41 Location IN 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
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
Mar 10, 2009 #2 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR find /path/to/dir -type f -mtime -1 | xargs rm Hope This Helps, PH. FAQ219-2884 FAQ181-2886 Upvote 0 Downvote
Mar 10, 2009 #3 motoslide MIS Joined Oct 30, 2002 Messages 764 Location US 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. Upvote 0 Downvote
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.
Mar 11, 2009 #4 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR OOps, good catch motoslide, I've inverted the test. Upvote 0 Downvote
Mar 16, 2009 #5 stefanwagner Programmer Joined Oct 19, 2003 Messages 2,373 Location DE 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 Upvote 0 Downvote
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
Mar 17, 2009 #6 KenCunningham Technical User Joined Mar 20, 2001 Messages 8,475 Location GB Which flavour of find is that Stefan? I want to be good, is that not enough? Upvote 0 Downvote
Mar 17, 2009 #7 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi Doh, I would loose. My bet was that PHV will post that question. ;-) ( Is available in GNU [tt]find[/tt] since version 4.2.3, implemented on 2004-10-30. ) Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Doh, I would loose. My bet was that PHV will post that question. ;-) ( Is available in GNU [tt]find[/tt] since version 4.2.3, implemented on 2004-10-30. ) Feherke. http://rootshell.be/~feherke/
Mar 17, 2009 #8 KenCunningham Technical User Joined Mar 20, 2001 Messages 8,475 Location GB Had a feeling it might have been, Feherke! I want to be good, is that not enough? Upvote 0 Downvote
Mar 17, 2009 #9 stefanwagner Programmer Joined Oct 19, 2003 Messages 2,373 Location DE 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 Upvote 0 Downvote
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
Mar 17, 2009 #10 razalas Programmer Joined Apr 23, 2002 Messages 237 Location US 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 Upvote 0 Downvote
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