LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-11-2015, 05:57 PM   #16
jmgibson1981
Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Ubuntu LTS
Posts: 122

Rep: Reputation: Disabled

-maxdepth flag for find. will go only as deep as you tell it to in its search for files. if i'm understanding correctly the question that is?

Code:
find /var/example/logs/* -type d -maxdepth 0 -mtime +89 -exec -mv '{}' /mnt/archivedrive/archive/example/logs/ \;
then for the yearly cleanup
Code:
find /mnt/archivedrive/archive/example/logs/ -type d -maxdepth 0 -mtime +355 -exec rm -fr {} \;

Last edited by jmgibson1981; 12-11-2015 at 05:58 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find the directories which is older than x days delete and zip those directories ramesh pagadala Linux - Newbie 2 08-29-2013 09:17 AM
How to compress and move log older than 30 days from one folder to another LittleMaster Linux - Newbie 6 09-20-2012 01:30 AM
[SOLVED] Attempting to delete files that are older than 90 days, but not directories caiphn Linux - Newbie 12 07-07-2012 08:11 PM
Need to move folders older than 5 days to a bad up directory calicowboy54 Linux - Newbie 4 01-15-2012 10:27 PM
How to move files older than 30 days gfem AIX 8 11-08-2006 05:58 AM


All times are GMT -5. The time now is 12:03 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration