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

  • Home
  • SEARCH
  • 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 94893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:34:22+00:00 2026-05-10T23:34:22+00:00

I’m trying to do what I think is a simple thing under Linux. I

  • 0

I’m trying to do what I think is a simple thing under Linux. I have a bash script which runs various test programs, and I want to determine which files in the current directory were created by the test programs. So I am doing something like this:

 touch timestamp-file run the test find -newer timestamp-file -type f > list-of-files rm -f timestamp-file 

Turns out the granularity of find -newer is poor, so what typically happens is that some files which were generated by the test program show up as OLDER than the timestamp file. So then I tried this:

 ls -tr1 | sed '1,/timestamp-file/d' 

to generate the same list. This usually works, but not always. I still end up with the situation where files which were generated by the test show up as older than the timestamp file.

Thanks!

P.S. I can accomplish this another way by taking two snapshots of the directory, one before the test program runs, and then one after, and comparing them. Any files in the second list which are not in the first must have been created by the test program (I’m not concerned with background jobs or other users writing to the dir). But this method is not what I want because if an output file wasn’t removed prior to running the test (they’re supposed to be, but in some cases they may not be), this method will say it was not created by the test program because it was in the dir before the test program was run.

  • 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. 2026-05-10T23:34:23+00:00Added an answer on May 10, 2026 at 11:34 pm

    Take the filenames of all the files before the run, but include their timestamps:

    find -printf '%p %T@\n' | sort > file1 

    If you haven’t got that find option available, you can use stat for that job too:

    find -print0 | xargs -0 stat -c '%n %Y' | sort > file1 

    And after the run to file2. Then use

    comm -1 -3 file1 file2 

    And it will show you the lines unique to file2, which must be new files if i’m not mistaken. If they existed before, their modification time will have changed, which is taken care by the %T@ thingy (printing out the number of seconds since 1970):

     [js@HOST2 cpp]$ find -printf '%p %T@\n' | sort > file1 [js@HOST2 cpp]$ echo foo>bar [js@HOST2 cpp]$ echo foo>baz [js@HOST2 cpp]$ find -printf '%p %T@\n' | sort > file2 [js@HOST2 cpp]$ comm -1 -3 file1 file2 . 1230947309.0000000000 ./bar 1230947308.0000000000 ./baz 1230947309.0000000000 ./file2 1230947315.0000000000 [js@HOST2 cpp]$ find -printf '%p %T@\n' | sort > file1 [js@HOST2 cpp]$ echo lol>bar [js@HOST2 cpp]$ find -printf '%p %T@\n' | sort > file2 [js@HOST2 cpp]$ comm -1 -3 file1 file2 ./bar 1230947359.0000000000 ./file2 1230947362.0000000000 [js@HOST2 cpp]$` 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 96k
  • Answers 96k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The autorelease pool only gets drained when the run loop… May 11, 2026 at 7:12 pm
  • Editorial Team
    Editorial Team added an answer Here is a reasonable source that derives an orthogonal project… May 11, 2026 at 7:12 pm
  • Editorial Team
    Editorial Team added an answer How about making the activity indicator invisible in previous controller's… May 11, 2026 at 7:12 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.