Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Find total size for some files?

UNIX for Dummies Questions & Answers


Tags
mtime

Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-06-2008
helen008 helen008 is offline
Registered User
 
Join Date: Jun 2008
Last Activity: 9 June 2008, 6:04 PM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Find total size for some files?

Hi,

I'm newbie to Unix. I'd like to count the total size of those files in my directory by date. For example, files on this period 05/01/08 - 05/31/08. If possible can we count by byte instead of kb.

if I use $ du - ks , it will add up all files in the dir.


thanks,
Helen
Sponsored Links
    #2  
Old Unix and Linux 06-07-2008
robotronic's Unix or Linux Image
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
 
Join Date: Apr 2002
Last Activity: 20 December 2009, 10:56 AM EST
Location: Italy
Posts: 370
Thanks: 0
Thanked 0 Times in 0 Posts
You can use something like this to find the size (in bytes) of all files in the current directory modified within last 30 days:


Code:
find . -type f -mtime -30 -exec ls -l {} \; | awk '{ s+=$5 } END { print s }'

I really don't know how we could specify a begin/end date range.
Sponsored Links
    #3  
Old Unix and Linux 06-07-2008
helen008 helen008 is offline
Registered User
 
Join Date: Jun 2008
Last Activity: 9 June 2008, 6:04 PM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
can we grep the filenames and sizes for this range (05/01/08 - 05/31/08) and output them to a file?
    #4  
Old Unix and Linux 06-07-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 28 May 2015, 11:09 AM EDT
Location: NM
Posts: 10,454
Thanks: 337
Thanked 861 Times in 800 Posts
touch two files - one with the start and the other with the end time you need.

Code:
touch -t 200805010000.01 dummy1
touch -t 200805312359.59 dummy2
find /path  \( ! -newer dummy1 -a newer dummy1 \) -type f -exec ls -l {} \;

apply Franklin's code or whatever to the output
Sponsored Links
    #5  
Old Unix and Linux 06-08-2008
robotronic's Unix or Linux Image
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
 
Join Date: Apr 2002
Last Activity: 20 December 2009, 10:56 AM EST
Location: Italy
Posts: 370
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL

Very smart solution jim! There's always something to learn.

I have to write this down: for the future, you'll never know Linux
Sponsored Links
    #6  
Old Unix and Linux 06-09-2008
helen008 helen008 is offline
Registered User
 
Join Date: Jun 2008
Last Activity: 9 June 2008, 6:04 PM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
I didn't see dummy2 in FIND command. Instead of 2 dummy1s.

But, I got this error!

find: bad option newer
find: path-list predicate-list
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find the total size of all directories that are owned by a particular User firestar Shell Programming and Scripting 2 03-07-2011 04:05 PM
get total size of files kaushik02018 UNIX for Dummies Questions & Answers 6 12-02-2010 07:03 AM
Solaris 10 - How to find the total size of my hard disk? saagar Solaris 3 04-04-2009 04:58 PM
command to find out total size of a specific file size (spread over the server) abhinov Solaris 3 08-08-2007 06:48 AM
How to find the total size of a dirctory tree in Solaris 0ktalmagik Filesystems, Disks and Memory 1 05-06-2006 09:31 AM



All times are GMT -4. The time now is 12:07 PM.