Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import shutil
- import datetime
- import os
- import fileinput
- original_file = "\network\path\to\file"
- def date_rename_file():
- todays_date = datetime.datetime.now()
- stripped_time = todays_date.strftime('%Y%m%d')
- shutil.copyfile(original_file, "\network\path\to\backupfolder\device_"+str(stripped_time)+".txt")
- def device_id_replace():
- original_id = input("What device ID are you needing to replace?")
- new_id = input("What is the new device ID?")
- with open(original_file, 'w') as devicetxt:
- for line in devicetxt:
- print(line)
- if original_id in line:
- print("Found "+original_id)
- date_rename_file()
- device_id_replace()
Add Comment
Please, Sign In to add comment