I did a bit of research and came up with the basics for changing the file name and that worked great, but need to insert the current year and date into the file name.
I'm assuming the time variable will come out to 2022-01(or something similar), and I'm also guessing I need to add the .txt suffix in some how to complete the new file name, but I'm guessing my elementary NewName variable isn't even close much less isn't even inserted into the new file variable. I've already got a bunch of year/month/day/time variables if that is easier to implement.
Any suggestions would be greatly appreciated. Thanks
- Code: Select all
import os
import time
time = (indigo.server.getTime().strftime('%Y-%M'))
NewName = "time"".txt"
old_file = os.path.join("/Users/Kitchen/Desktop", "temp.txt")
new_file = os.path.join("/Users/Kitchen/Desktop", "temp2.txt")
os.rename(old_file, new_file)