LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-24-2011, 04:27 PM   #1
ktfreak
LQ Newbie
 
Registered: Nov 2010
Posts: 14

Rep: Reputation: 0
DU command - summary of files and folders


Hi guys,

I use the following command to find files which are older than 60 days:
find /myfolder/* -mtime +60 > /myfolder/file.list

Now I want to find out the file size of all files contained in file.list in summary using the du command:
less /myfolder/file.list | xargs du -sh

The du command prints the file sizes of every single file but not the summary and this is actually what I want.

Does anyone have an idea?

Thanks,
 
Old 06-24-2011, 05:21 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
If you read the manpage you'll see the -c option for a total.
 
Old 06-24-2011, 06:11 PM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
interesting,
I think that du doesn't work on file list, but in the directory.
Code:
find /mydir/* -mtime -60 | xargs du -hs 
du: invalid option -- p
du: unrecognized option `--dport'
du: invalid option -- j
Try `du --help' for more information.
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
so there is a catch probably how to do it with a file list?

otherwise "du" gives me:
Code:
du /etc/postfix/ -hcs
564K    /etc/postfix/
564K    total

Last edited by lithos; 06-24-2011 at 06:12 PM.
 
Old 06-24-2011, 06:18 PM   #4
ktfreak
LQ Newbie
 
Registered: Nov 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Damned!
I was so focused by the -s parameter that indeed doesn't work with the retrieving files from a file method...

In addition, the command 'grep total' turns this in a nice piece of work I think
less /myfolder/file.list | xargs du -csh | grep total

I can work with that...

thanks

Last edited by ktfreak; 06-25-2011 at 08:43 AM.
 
  


Reply


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
Recovery deleted folders and files when using rm -rf command ytd Linux - General 6 04-06-2010 07:59 AM
find -exec command to recursively delete files and folders in folders with X name Joan Murt Linux - Newbie 2 07-08-2009 05:35 PM
Command to copy files/folders but skip bad/corrupt files?? leemoreau Linux - Newbie 2 04-02-2007 03:27 PM
what is the command to delete files and folders quickly. ravi Linux - General 1 03-13-2007 01:09 PM
moving files and folders thru command line JROCK1980 Linux - General 2 02-16-2004 07:55 PM


All times are GMT -5. The time now is 08:32 PM.

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