Testing whether the folder was created at a certain time by the python



  • I want to make an alert in cases where a folder has not been created. We've got a HandyBackup program that creates a folder with the name:

    2016_07_27
    

    One day, for example, at 9:00 a.m., we need to check whether this folder has been created or not.

    import time
    import datetime
    import os 
    from datetime import timedelta
    

    yesterday = datetime.datetime.now() - datetime.timedelta(days=1)
    split = str(yesterday).split(' ')
    replaceTire = split[0].replace("-" , "_")
    test = os.path.isdir('//host1/e$/BackUp/HandyBackUp/SQL1/' + replaceTire)

    print(replaceTire)
    print(test)

    I'm still learning how to program, but I've got this kind of violin, it's working really well, but now I don't know how to do time checks. It should be a cycle and a condition if. I want to check the folder at 9:00 in the morning.
    An important addition, for example, is that he' report it all once and for all, until the next check, in an endless cycle, will he report it all the time?
    Thank you!


  • QA Engineer

    You don't need an endless cycle, he's gonna be scrupulous around the cricket for 24 hours.

    Make a scrupt that works once at the right time, and start it on schedule.

    Look in the google at the request of the mission planner with your operating system.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2