Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 825321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:14:09+00:00 2026-05-15T03:14:09+00:00

I have the following command that I run on cygwin: find /cygdrive/d/tmp/* -maxdepth 0

  • 0

I have the following command that I run on cygwin:

find /cygdrive/d/tmp/* -maxdepth 0
-mtime -150 -type d |
xargs du –max-depth=0 > foldersizesreport.csv

I intended to do the following with this command:

for each folder under /d/tmp/ that was modified in last 150 days, check its total size including files within it and report it to file foldersizesreport.csv
however that is now not good enough for me, as it turns out inside each

/d/tmp/subfolder1/somefile.properties
/d/tmp/subfolder2/somefile.properties
/d/tmp/subfolder3/somefile.properties
/d/tmp/subfolder4/somefile.properties

so as you see inside each subfolderX there is a file named somefile.properties
inside it there is a property SOMEPROPKEY=3808612800100 (among other properties)

this is the time in millisecond, i need to change the command so that instead of -mtime -150 it will include in the whole calculation only
subfolderX that has a file inside them somefile.properties where the SOMEPROPKEY=3808612800100 is the time in millisecond in future, if the value SOMEPROPKEY=23948948 is in past then dont at all include the folder
in the foldersizesreport.csv because its not relevant to me.

so the result report should be looking like:

/d/tmp/,subfolder1,<itssizein KB>
/d/tmp/,subfolder2,<itssizein KB>

and if subfolder3 had a SOMEPROPKEY=34243234 (time in ms in past) then it would not be in that csv file.

so basically I’m looking for:

find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | 
   <only subfolders that have in them property in file 
   SOMEPROPKEY=28374874827 - time in ms in future and 
   not in past | xargs du --max-depth=0 > foldersizesreport.csv
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:14:10+00:00Added an answer on May 15, 2026 at 3:14 am

    Here’s a perl version for the whole thing:

    filter.pl

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    use File::Spec;
    
    # -------------------------- configuration ----------------------------
    my %CFG = (
           'propertiesFile' => 'somfile.properties',
           'propertyKey' => 'SOMEPROPKEY',
           'duCommand' => 'du -Bk -s'
    );
    # ---------------------------------------------------------------------
    
    while (my $dir = <>) {
           chomp $dir;
           open(my $F, File::Spec->catfile($dir, $CFG{"propertiesFile"})) || next;
           my ($match) = grep /$CFG{"propertyKey"}=\d+/, <$F>;
           close $F;
    
           if ($match =~ m/$CFG{"propertyKey"}=(\d+)/) {
                   my ($volume, $directories, $file) = File::Spec->splitpath($dir);
                   my $command = "$CFG{'duCommand'} $dir";
                   # on Windows you might need $volume this assumes Unix-like filesystem
                   print $directories . "," . $file . "," .
                           `$command | cut -f1` if $1 > time();
           }
    }
    
    exit;
    

    usage

    find /home/regis/stackoverflow/2937940/* -maxdepth 0 
      -mtime -150 -type d | ./filter.pl
    

    output (with your sample)

    /home/regis/stackoverflow/2937940/,subfolder1,16K
    /home/regis/stackoverflow/2937940/,subfolder2,16K
    /home/regis/stackoverflow/2937940/,subfolder4,16K
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following SQL command that I need to save as a csv
I have the following command which deletes files that are one day old and
I have the following function that deletes the LaTeX command surrounding the current cursor
I currently have a .command file for Mac that contains the following: for f
I have created following command line to run cron job after every 2minutes 2
I want to run a command that gives the following output and parse it:
I have created a Yii command that needs to be run every month. If
I have following command that runs on Windows: java -classpath lib/prov-jdk14-132.jar;../EncUtility com.xxxx.projects.disc.bowl.FileChooseApp Now I
I have the following command which will loop over all the subdirectories in a
I have found the following command in AWK useful in Vim :'<,'>!awk '{ print

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.