Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Looking for command line to find dirs based on size and date Post 302892063 by Yoda on Monday 10th of March 2014 03:49:36 PM
Old 03-10-2014
One way of doing this is using stat command:
Code:
du -sm /wlwork/epc_domain/stage/job* | while read size dir
do
        d_epoch=$( stat --printf=%Y "$dir" )
        c_epoch=$( date +%s )

        (( diff = ( c_epoch - d_epoch ) / 86400 ))

        if [ $diff -gt 2 ] && [ $size -gt 50 ]
        then
                echo "Deleting dir: $dir"
                # Delete here
        fi
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Traversing thru dirs and deleting files based on date

Hi Folks I am pretty new to unix and shellscripting. I need help on writing logic on traversing recursively through a set of directories under a top-level folder and delete files(mostly text) which are 1 month old. Can you people help me on this? Thanks a lot Ravi (5 Replies)
Discussion started by: ravi2082
5 Replies

2. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

3. UNIX for Advanced & Expert Users

Find file size and date

Hi in my shell script I have to do this 1. there is a file called testing.txt in /home/report directory If the file size is 0(zero) and date is today's date, then I have to print "Successful" else "Failed". 2. There is a file called number.txt which will have text only one line like this... (10 Replies)
Discussion started by: gsusarla
10 Replies

4. Shell Programming and Scripting

Find command and pruning .dirs

I'm sure this has been asked before but I couldn't find it with the search. I have a script that looks for files and then moves to another location for further processing. My problem is I can't seem to prune the .s* directories. It doesn't break anything just wanted a cleaner process. Here... (4 Replies)
Discussion started by: jcalisi
4 Replies

5. HP-UX

find command to display size and date of a file

Hi, The blow code does not yeild any output. find . -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" -exec ls -l {} \; I wish to print the filename filesize filedate in HP-UX. Can anyone help ? (9 Replies)
Discussion started by: mohtashims
9 Replies

6. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

7. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

8. HP-UX

HP/UX command to pull file name/date based on date

HI, Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
Discussion started by: lnemitz
2 Replies

9. UNIX for Beginners Questions & Answers

Cut each line based on the character size

Hello All, I have a file which contain below lines. The starting word of each line is call and the end line is semi colon. I need to find the character size of each line and then move it to a file. If the character size is more than 255 then I need to push that line to a next file and I need... (6 Replies)
Discussion started by: JoshvaPeter
6 Replies

10. UNIX for Beginners Questions & Answers

Append each line based upon the character size

I have a huge file which contains multiple lines. It need to check whether character length is not more than 255 each line. If its not then it should remove the character up to column. I have described in the output below. If its more than that the next line should start with call but if the... (1 Reply)
Discussion started by: JoshvaPeter
1 Replies
scan(1) 						      General Commands Manual							   scan(1)

NAME
scan - produce a one-line-per-message scan listing (only available within the message handling system, mh) SYNOPSIS
scan [+folder] [msgs] [options] OPTIONS
Directs scan to clear the screen. If the -clear switch is used and the output of scan is directed to a terminal, then scan consults the $TERM and $TERMCAP environmental variables to determine your terminal type in order to find out how to clear the screen prior to exiting. If the -clear switch is used and the output of scan is not directed to a terminal, then scan sends a formfeed prior to exiting. Re-formats the output of scan according to the instructions in the named file. The named formatfile must be in mh-format style; see mh-format(4) for more details. Re-formats the output of scan according to the instructions in the string given. The string must be in mh-format style; see mh-format(4) for more details. You must place the string argument to this command in double quotes ("). Produces a header line prior to the scan listing. The header line displays the name of the folder and the date and time. This can be suppressed using the -noheader option. Prints a list of the valid options to this command. Lists the output from scan in reverse order, from the highest message number to the lowest. The -noreverse option lists messages in the conventional way, from lowest to highest numbers. The -noreverse option is the default. Specifies the width of your screen, in columns. The defaults for this command are as follows: +folder defaults to the current folder msgs defaults to all -noheader -width defaults to the width of the terminal DESCRIPTION
The scan command produces a one-line-per-message listing of the messages in the current folder. You can scan a folder other than the current folder by using the +folder argument. You can use the msgs argument to produce a scan listing of a number of messages or a range of messages in the specified folder. You can also use scan in conjunction with a message sequence defined by mark or pick. See mark(1) for more information on sequences. Each scan line contains the message number, the date, the From: field, the Subject: field, and, if room allows, some of the body of the message. The current message is marked with a plus sign (+). The scan command actually reads each of the specified messages and parses them to extract the desired fields. If format errors are found in any of the messages during parsing, scan produces appropriate error messages. Because MH has been configured with the BERK option, scan has two additional options: -reverse and -noreverse. In addition, scan updates the MH context prior to starting the listing, so interrupting a long scan listing preserves the new context. The default configuration file that is supplied with MH has the BERK option enabled. If scan encounters a message without a Date: field, the date is filled in with the last write date of the message, and an asterisk (*) is appended. This is useful for identifying unsent message drafts. Unsent drafts are not usually allowed to contain a Date: field, and are consequently marked with an asterisk in scan listings. PROFILE COMPONENTS
Path: To determine your Mail directory Alternate-Mailboxes: To determine your mailboxes EXAMPLES
The following example produces a listing of messages 11 through 15 in the folder +inbox : % scan +inbox 11-15 11 18/01 ralph Project Plan Meeting Monday<<This 12 -21/01 johnson squash<<Thought i might postpone 13 21/01 smith@ultrixhost support from US during conversion 14 21/01 jjones@subone.dne new forum for discussion of mail 15+ 21/01 calvin@hobbes.uuc Re: new forum for discussion of m In this listing, the plus sign (+) on message 15 indicates that it is the current message. The hyphen (-) on message 12 indicates that you have replied to the message. It is produced by the -annotate option to repl; see repl(1) for more information. If there is sufficient room left on the line after the subject, scan fills the line with text from the body, preceded by <<, and terminated by >> if the body is suffi- ciently short. FILES
The user profile. SEE ALSO
inc(1), mark(1), pick(1), show(1), mh-format(4) scan(1)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy