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 8611433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:22:30+00:00 2026-06-12T04:22:30+00:00

So I have a script that checks for files newer than 1 day old.

  • 0

So I have a script that checks for files newer than 1 day old. I want my script to send me an email if there are no files in this directory that are less than one day old, like it was created today.

My script, let me show you it:

new_files = [] #list of files newer than 1 day
for f in os.listdir(path):
 fn = os.path.join(path,f)
 ctime = os.stat(fn).st_ctime
 if ctime > now - 1 * 86400:
 #this is a new file
  new_files.append(fn)
 if new_files(): #checks the list
  sendmail #calls sendmail script that sends email

So, if new_files(): is me checking my list to see if anything was appended to it. If not, then the process failed and we need to know, by generating an alert email to our ticketing system. This is where my problem is. I don’t know how to check the list. When I run the script, I get TypeError: 'list' object is not callable.

What’s the right way to do this?

  • 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-06-12T04:22:32+00:00Added an answer on June 12, 2026 at 4:22 am

    Counting the occurrence will help.

    new_files = [] #list of files newer than 1 day
    for f in os.listdir(path):
       fn = os.path.join(path,f)
       ctime = os.stat(fn).st_ctime
       if ctime > now - 1 * 86400:
            countit=new_files.count(fn)  #count previous occurence
            #this is a new file
            new_files.append(fn)
            if new_files.count(fn)>countit: 
                 sendmail #calls sendmail script that sends email
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having this issue. I have a script that checks if variable exists,
I have this script that collects data from users and I want to check
I've got a PHP script that checks a directory and deletes any files not
I have a python script that checks a certain folder for new files and
I have a bash script that checks some log files created by a cron
I'm having some trouble figuring this out. I have a script that checks a
I have a script that pulls files from a FTP directory on a set
I have a PHP script that checks an email address to determine if it
I have an existing python script that, among other things checks a file against
I have a script that checks something on my PC every 5 minutes and

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.