Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions madlibs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import shutil, os, datetime


def date(filename: str) -> str:
return f"{datetime.datetime.now()} - {filename}".replace(":", " ")


def rename(file: str, path: str):
fullpath = os.path.join(path, file)
if os.path.isdir(fullpath):
for sub in os.listdir(fullpath):
rename(sub, fullpath)

datedname = date(file)
print(datedname)
os.rename(fullpath, os.path.join(path, datedname))


initialpath = input("Please input path: ")

rename(initialpath, ".")