I want to cleanup my files and am currently stuck after extracting the list of folders in a directory. I want to extract the date portion of the folders and generate .txt files based on these dates.
Below code I used:
import os
root ="C:\\Users\\Mr. Slowbro\\Desktop\\Test Python\\"
dirlist = [ item for item in os.listdir(root) if os.path.isdir(os.path.join(root, item)) ]
print (dirlist)
The output is as below list:
['01 Jan 20 - Alpha', '08 Sept 19 - Bravo', '31 Dec 18 - Receipt Folder']
How do I get the following output and generate them as .txt files in another folder?
eg.
01 Jan 20.txt
08 Sept 19.txt
31 Dec 18.txt