Find directories that are not used for 500 days


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find directories that are not used for 500 days
# 1  
Old 01-09-2012
Find directories that are not used for 500 days

How to list the directories that are not acessed for more than 500 days?

i used find in the following way
Code:
find . -type d -atime +500 -exec du -sh {} \;

but it is listing all the sub direcories of the parent directories which satisfy above condiion.I would like to get just name of the parent directories(not subdirectories).their last acess time with size.


Thanks.


Moderator's Comments:
Mod Comment How to use code tags

Last edited by Franklin52; 01-09-2012 at 03:27 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 01-09-2012
Use -maxdepth 1 with your find statement

--ahamed
This User Gave Thanks to ahamed101 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to compress the directories which is older than 7 days?

Hi all, how to compress the directories which is older 7 days. If any one knows please help me this is urgent. Thanks in advance (3 Replies)
Discussion started by: rameshpagadala
3 Replies

2. HP-UX

Find file more than 500 MB

Hi, I used to use the below command on Solaris find /var/tmp -size +500000 -exec ls -e {} \; but this command does not seem to work on HP-UX. Can you help me list all files under /var/tmp and its sub-directories which are more than 500MB in size ? (7 Replies)
Discussion started by: mohtashims
7 Replies

3. Shell Programming and Scripting

Fill the values between -500 to 500 -awk

input -200 2.4 0 2.6 30 2.8 output -500 0 -499 0 -488 0 .......... .......... .... -200 2.4 .... ... 0 2.6 (6 Replies)
Discussion started by: quincyjones
6 Replies

4. Shell Programming and Scripting

Find directories only and delete them created 3 days before

Hello I have some directories and files created under /export/local/user I would like to delete directories only under /export/local/user, created before 3 days Can someone help me with command to do this task? Thanks (4 Replies)
Discussion started by: needyourhelp10
4 Replies

5. Shell Programming and Scripting

Finding directories older than 5 days

Hello, Motive: Search all directories which are older than 5 days. Example: consider following directory structure: abc/dir1 abc/dir1/dir abc/dir2 abc/dir3 abc/dir3/temp Suppose dir1 and dir3 are 5 days older. Then I am looking for a command which lists abc/dir1 and abic/dir3 only so that... (4 Replies)
Discussion started by: mytempid07
4 Replies

6. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

7. Shell Programming and Scripting

Using cron to delete directories 90 days old

We use Solaris 10 x86 and I want to use a cron job to remove directories +90 old. Currently I have the command below but it only cleans the files and keeps the directory. What am I doing wrong? /opt/tesk/batch/kit/archive/* -mtime +90 -exec rm -r {} \: Thank you (3 Replies)
Discussion started by: oh-daa
3 Replies

8. Red Hat

Find files older than 30 days in directories and delete them

Hi, I have dummies questions: My script here can find the files in any directories older than 30 days then it will delete the files but not the directories. I would like to also be able to delete the directories that hold old files more than 30 days not just the files itself. find . -type f... (2 Replies)
Discussion started by: lamoul
2 Replies

9. Shell Programming and Scripting

Delete files from sub-directories over 7 days

Can any one please help me in deleting all the Files over 7 days from sub-directories A, B, C... Top-Directory Sub-Directory-A File-1 File-2 ..... File-n Sub-Directory-B File-1 File-2 ..... File-n Sub-Directory-C File-1 ... (1 Reply)
Discussion started by: sureshcisco
1 Replies

10. HP-UX

Command for delete the directories which are older than 7 days

Hi, My requirement is need to delete the directories (Including files also) which are older than 7 days. So I used below command in one script (script takes 2 input parameters) #$1 - Path of the directory from where we have to delete the directories.# #$2 - Number of days older... (1 Reply)
Discussion started by: sridhar sivakot
1 Replies
Login or Register to Ask a Question