Updated paths for useage on actual PC. Fixed path error in getmtime.
This commit is contained in:
7
main.py
7
main.py
@@ -10,22 +10,19 @@ auth_token = 'd40c831e56785afaa9294fd3c5a88e6e'
|
|||||||
client = Client(account_sid, auth_token)
|
client = Client(account_sid, auth_token)
|
||||||
|
|
||||||
# File Paths
|
# File Paths
|
||||||
local_path = 'C:\\Users\\ICYN3\\Documents\\dev\\BiFileMover\\'
|
local_path = 'C:\\BlueIris\\New\\'
|
||||||
remote_path = 'Y:\\'
|
remote_path = 'Y:\\'
|
||||||
|
|
||||||
# Logging Setup
|
# Logging Setup
|
||||||
logging.basicConfig(filename='mover.log', format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',
|
logging.basicConfig(filename='mover.log', format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',
|
||||||
level=logging.INFO)
|
level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check if the mapped drive is connected
|
# Check if the mapped drive is connected
|
||||||
remoteOn = os.path.exists(remote_path)
|
remoteOn = os.path.exists(remote_path)
|
||||||
|
|
||||||
print(remoteOn)
|
|
||||||
if remoteOn is True:
|
if remoteOn is True:
|
||||||
for file in os.listdir(local_path):
|
for file in os.listdir(local_path):
|
||||||
t = os.path.getmtime(file)
|
t = os.path.getmtime(local_path + file)
|
||||||
age = (time.time() - t) / 86400
|
age = (time.time() - t) / 86400
|
||||||
if age >= 7:
|
if age >= 7:
|
||||||
shutil.move(local_path + file, remote_path + file)
|
shutil.move(local_path + file, remote_path + file)
|
||||||
|
|||||||
Reference in New Issue
Block a user