Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

file size

Posted on 2011-03-04
6
Medium Priority
?
284 Views
Last Modified: 2012-06-22
Hi,

How can I get the file size of all the files starting feb 2, 2011 up to feb 8, 2011?

Cheers!
0
Comment
Question by:mikesteven
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:alphabet26
ID: 35039441
as a sum of the file sizes or just display them?
0
 
LVL 4

Expert Comment

by:Tomun
ID: 35039500
Try this:
find . -maxdepth 1 -type f  -newermt "2011-02-02 00:00" ! -newermt "2011-02-07 23:59" -exec /usr/bin/du -ch {} +

Open in new window


you might need to change the path to du (which du) to find it.
0
 

Author Comment

by:mikesteven
ID: 35039861
yes please, as a sum
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 4

Expert Comment

by:Tomun
ID: 35039924
The sum is at the bottom of the output of the command I gave. It may not work if there are too many matching files though as it passes them all as arguments to du and you might run into the maximum command line length.

Remove the -maxdepth 1 if you want to look in subdirectories too.
0
 

Author Comment

by:mikesteven
ID: 35040769
Tomun, there's gonna be like 6,000 files matching will that work?
0
 
LVL 4

Accepted Solution

by:
Tomun earned 2000 total points
ID: 35040892
II think it'll split the command into multiple lines if it's too long so add a "| grep total$" to the end to show only the totals and if you get more than one total you'll just have to add them together.

Here it is in full (I fixed an issue with the dates too).

find . -maxdepth 1 -type f  -newermt "2011-02-01 23:59:59" ! -newermt "2011-02-07 23:59:59" -exec /usr/bin/du -ch {} +|grep total$

Open in new window


The dot after the find command means the current directory, change that if you want to look somewhere else.

If that's not good enough there may be a better way to do it, but it might be more than a one liner. Try it and see how you get on.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question