How to import one day old logs
Question: I am new to Python and need some help in being able to import done day old
logs. Below is the script I have come up with, but not sure if it is working
or if there is a better way to do this.

    
    
    def fileCreation(path):  
        now = time.time()  
        oneday_ago = now - (24*60*60) ## seconds in 1 day  
        if fileCreation < oneday_ago:  
            print f  
            getAuditRecords(f)  
    

I have a script that does import the whole database from mid June 2014 but
only need to get day old logs.

Here is a sample of the logs I am trying to import

> /mnt/hcp1/R1P/R1P_ora_982_2.xml.201409070400  
>  /mnt/hcp1/R1P/R1P_ora_20_1.xml.201409070400  
>  /mnt/hcp1/R1P/R1P_ora_29962_1.xml.201409070400  
>  /mnt/hcp1/R1P/R1P_ora_15593_2.xml.201409070400  
>  /mnt/hcp1/R1P/R1P_ora_9946_1.xml.201409070400  
>  /mnt/hcp1/R1P/R1P_ora_10746_1.xml.201409070400  
>  /mnt/hcp1/R1P/R1P_ora_6508_1.xml.201409070400  
>  /mnt/hcp1/R1P/R1P_ora_17340_2.xml.201409070400  
>  /mnt/hcp1/SCC/SCC_ora_18881_2.xml.201407090400


Answer: Regarding the "two days ago" part, you should use `datetime.datetime` and
`datetime.timedelta`

E.g.

    
    
    import datetime
    
    now = datetime.datetime.now()
    two_days = datetime.timedelta(days=2)
    two_days_ago = now - two_days
    

