Finding cumulative size of files older than certain days


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding cumulative size of files older than certain days
# 1  
Old 04-28-2008
Tools Finding cumulative size of files older than certain days

Hi All,
I've got a ton of files in a particular directory. I want to find pdf files older than 30 days in that directory and then the cumulative size of those files.

Ex:

find /home/jk/a -name "*.pdf" -mtime +30
consider it finds the below 4 files.
/home/jk/a/1.pdf
/home/jk/a/2.pdf
/home/jk/a/3.pdf
/home/jk/a/4.pdf

now I want to know the total size of these 4 files. Any help would be appreciated.
# 2  
Old 04-28-2008
nevermind, i figured it out. Thanks guys

If anyone is interested I piped the output with the following

-exec ls -l {} \;| awk '{s+=$5} END {print "Total SIZE: " s}'
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Finding files older than x days within directory with spaces

Hi, I am trying to run a command that finds all files over x amount of days, issue is one of the directories has spaces within it. find /files/target directory/*/* -type f -mtime +60 When running the above the usual error message is thrown back + find '/files/target\' 'directory/*/*' -type... (1 Reply)
Discussion started by: Ads89
1 Replies

2. Shell Programming and Scripting

List files older than 10 days.

Hello all, I want to list the files older than 10 days. Currently am using find ./ -mtime +10 -exec ls -ltr {} \; command. But I want to execute the same command in 16 directories at a time and want an output asking to remove those file? Please help me to design the script. regards, Ajay (3 Replies)
Discussion started by: 02Ajay
3 Replies

3. UNIX for Dummies Questions & Answers

Size of files which are older than x days

Hi I want to find the total space used by the files which are older than x days find ./ -type f -mtime +x-days -name "G00*" -exec du {} \; | awk '{total+=$1}END{print "TOTAL" total}' Total prints as 17.20 MB ( total / 1024*2 ) But actual size of it will be around 18.5 GB... (1 Reply)
Discussion started by: rakeshkumar
1 Replies

4. UNIX for Dummies Questions & Answers

Files older than 50 days

Hi All, OS :- HP-UX wm5qa B.11.23 U ia64 1119805695 unlimited-user license I need to search files older than 50 days. I've used following command in order to search desired files, I also discoverd, it's showing today's files as well. Do you have any clue with this ? wmqa1> find .... (4 Replies)
Discussion started by: alok.behria
4 Replies

5. UNIX for Advanced & Expert Users

removing files older than n days

Hi, on AIX 6.1, is there any commande line to remove the files older than n days in a directory ? Thanks. (2 Replies)
Discussion started by: big123456
2 Replies

6. 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

7. 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

8. UNIX for Dummies Questions & Answers

Delete files older than 30 days

This is driving me crazy. How can I delete files in a specifc directory that are over 30 days old? Thanks in advance. (3 Replies)
Discussion started by: tlphillips
3 Replies

9. Shell Programming and Scripting

Deleting / finding files older than X days missess a day

Hi When trying to find and delete files which are, say, 1 day, the find command misses a day. Please refer the following example. xxxd$ find . -type f -ctime +1 -exec ls -ltr {} \; total 64 -rw-rw-r-- 1 oracle xxxd 81 Apr 30 11:25 ./ful_cfg_tmp_20080429_7.dat -rw-rw-r-- 1... (4 Replies)
Discussion started by: guruparan18
4 Replies

10. UNIX for Dummies Questions & Answers

How can I delete files older than 7 days?

I will like to write a script that delete all files that are older than 7 days in a directory and it's subdirectories. Can any one help me out witht the magic command or script? Thanks in advance, Odogboly98:confused: (3 Replies)
Discussion started by: odogbolu98
3 Replies
Login or Register to Ask a Question