Combine du and find command

I wish to combine the du -k cmd and find . -mtime -1 command. How do I do that?

My aim is to calculate the size of new files in the current directory and subdirectory that was added in the last one day. How do I do that?
# find . <blah blah> -printf <blah blah>
find: bad option -printf
find: [-H | -L] path-list predicate-list

Open in new window

LVL 1
QLJAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TintinCommented:
find . | xargs du -k | awk '{t+=$1} END {print t}'
0
QLJAuthor Commented:
not quite right yet.. I was hoping to get something like this (but picked out for those that were new within a day)

9696    ./cur
1       ./new
1       ./tmp
195     ./.Trash/cur
1       ./.Trash/new
1       ./.Trash/tmp
245     ./.Trash
1       ./.Drafts/cur
1       ./.Drafts/new
1       ./.Drafts/tmp
6       ./.Drafts
50      ./.Sent/cur
1       ./.Sent/new
1       ./.Sent/tmp
93      ./.Sent
1       ./.Junk/cur
1       ./.Junk/new
1       ./.Junk/tmp
6       ./.Junk
1       ./.Spam/cur
1       ./.Spam/new
1       ./.Spam/tmp
6       ./.Spam
10602   .
0
TintinCommented:
Whoops, sorry about that.  I forgot that requirement.

Make it

find . -type f -mtime -1 | xargs du -k | awk '{t+=$1} END {print t}'

and if you wanted it sorted in size order do

find . -type f -mtime -1 | xargs du -k | awk '{t+=$1} END {print t}' | sort -n
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
QLJAuthor Commented:
still seems to give a total number.. but I guess it's fine as find . -type f -mtime -1 | xargs du -k gives the breakdown
0
TintinCommented:
I thought you wanted the total.  Oh well, as you found out, leaving out the awk line gives you the total for each file.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.