Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-11-2015, 04:57 PM   #16
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 715

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?

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

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


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 08:17 AM
How to compress and move log older than 30 days from one folder to another LittleMaster Linux - Newbie 6 09-20-2012 12:30 AM
[SOLVED] Attempting to delete files that are older than 90 days, but not directories caiphn Linux - Newbie 12 07-07-2012 07:11 PM
Need to move folders older than 5 days to a bad up directory calicowboy54 Linux - Newbie 4 01-15-2012 09:27 PM
How to move files older than 30 days gfem AIX 8 11-08-2006 04:58 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:24 PM.

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