Files

27 lines
735 B
Python
Raw Permalink Normal View History

from pathlib import Path
2023-09-07 17:09:51 -04:00
from pandas.core.frame import FormattersType
currentdir = "/Users/normrasmussen/Documents/Work/CustomerNotes/"
path_dir = Path("/Users/normrasmussen/Documents/Work/CustomerNotes/")
2023-09-06 17:15:21 -04:00
def path_files(path_dir):
listfiles = list(path_dir.glob("**/*.md"))
print(f"Successfully made the '{path_dir}' directory.")
for file in listfiles:
strfile = str(file)
2023-09-06 17:15:21 -04:00
company = strfile.split["/"](6)[:-3]
new_dir = path_dir / company
new_dir.mkdir()
file.rename(
f"/Users/normrasmussen/Documents/Work/CustomerNotes/{company}/{company}.md"
)
print(company)
2023-09-06 17:15:21 -04:00
company = strfile.split()
2023-09-07 17:09:51 -04:00
if __name__ == "__main__":
path_files(path_dir)