script for get today's files is exist or not if not get and move yesterday file [closed]












-3















Title - File checking python script
In python how i can know the today's files is exist or not in folder, if file is not present then get yesterday's file










share|improve this question















closed as unclear what you're asking by tripleee, petezurich, bummi, Matthias, jpp Nov 17 '18 at 20:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2





    Possible duplicate of How do I check whether a file exists without exceptions?

    – Christian König
    Nov 16 '18 at 7:48











  • Your question is probably going to get closed as it is unclear what you're asking. Learn how to ask a good question. stackoverflow.com/help/how-to-ask

    – Infected Drake
    Nov 16 '18 at 7:52
















-3















Title - File checking python script
In python how i can know the today's files is exist or not in folder, if file is not present then get yesterday's file










share|improve this question















closed as unclear what you're asking by tripleee, petezurich, bummi, Matthias, jpp Nov 17 '18 at 20:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2





    Possible duplicate of How do I check whether a file exists without exceptions?

    – Christian König
    Nov 16 '18 at 7:48











  • Your question is probably going to get closed as it is unclear what you're asking. Learn how to ask a good question. stackoverflow.com/help/how-to-ask

    – Infected Drake
    Nov 16 '18 at 7:52














-3












-3








-3








Title - File checking python script
In python how i can know the today's files is exist or not in folder, if file is not present then get yesterday's file










share|improve this question
















Title - File checking python script
In python how i can know the today's files is exist or not in folder, if file is not present then get yesterday's file







python python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 7:58









petezurich

3,73581936




3,73581936










asked Nov 16 '18 at 7:46









Er AnjumEr Anjum

116




116




closed as unclear what you're asking by tripleee, petezurich, bummi, Matthias, jpp Nov 17 '18 at 20:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by tripleee, petezurich, bummi, Matthias, jpp Nov 17 '18 at 20:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2





    Possible duplicate of How do I check whether a file exists without exceptions?

    – Christian König
    Nov 16 '18 at 7:48











  • Your question is probably going to get closed as it is unclear what you're asking. Learn how to ask a good question. stackoverflow.com/help/how-to-ask

    – Infected Drake
    Nov 16 '18 at 7:52














  • 2





    Possible duplicate of How do I check whether a file exists without exceptions?

    – Christian König
    Nov 16 '18 at 7:48











  • Your question is probably going to get closed as it is unclear what you're asking. Learn how to ask a good question. stackoverflow.com/help/how-to-ask

    – Infected Drake
    Nov 16 '18 at 7:52








2




2





Possible duplicate of How do I check whether a file exists without exceptions?

– Christian König
Nov 16 '18 at 7:48





Possible duplicate of How do I check whether a file exists without exceptions?

– Christian König
Nov 16 '18 at 7:48













Your question is probably going to get closed as it is unclear what you're asking. Learn how to ask a good question. stackoverflow.com/help/how-to-ask

– Infected Drake
Nov 16 '18 at 7:52





Your question is probably going to get closed as it is unclear what you're asking. Learn how to ask a good question. stackoverflow.com/help/how-to-ask

– Infected Drake
Nov 16 '18 at 7:52












1 Answer
1






active

oldest

votes


















2














You can do this with Python's simple error handling:



try:
open('directory/name_of_todays_file', 'r')
print('todays file exists')
except:
open('directory/name_of_yesterdays_file', 'r')
print('todays file does not exist')





share|improve this answer
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    You can do this with Python's simple error handling:



    try:
    open('directory/name_of_todays_file', 'r')
    print('todays file exists')
    except:
    open('directory/name_of_yesterdays_file', 'r')
    print('todays file does not exist')





    share|improve this answer






























      2














      You can do this with Python's simple error handling:



      try:
      open('directory/name_of_todays_file', 'r')
      print('todays file exists')
      except:
      open('directory/name_of_yesterdays_file', 'r')
      print('todays file does not exist')





      share|improve this answer




























        2












        2








        2







        You can do this with Python's simple error handling:



        try:
        open('directory/name_of_todays_file', 'r')
        print('todays file exists')
        except:
        open('directory/name_of_yesterdays_file', 'r')
        print('todays file does not exist')





        share|improve this answer















        You can do this with Python's simple error handling:



        try:
        open('directory/name_of_todays_file', 'r')
        print('todays file exists')
        except:
        open('directory/name_of_yesterdays_file', 'r')
        print('todays file does not exist')






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 16 '18 at 7:54









        Pang

        6,9891666105




        6,9891666105










        answered Nov 16 '18 at 7:52









        hhaefligerhhaefliger

        29712




        29712

















            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python