Python implements the classification of files

The requirements are as follows

 There is a folder to be classified on the desktop, or directly located under the desktop path, there are many unclassified files in different formats, and then they are organized according to file types.

Source code

The results obtained are as follows:

 

import os
import  shutil

#源目录,这里假设是桌面需要程序自动整理的路径
dirpath="C:\\Users\\Mango\\Desktop\\待分类"

#当前月份路径,定义按多少月份归档
currentMonth="2020年10月份整理\\"

#根路径,存放一年多个月的归档数据
rootpath="C:\\Users\

Guess you like

Origin blog.csdn.net/yql_617540298/article/details/109275654