程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python intermediate] reclassify files by their modification time

編輯:Python

【python intermediate 】 Reclassify files by their modification time

  • 1、 background
  • 2、 Code
  • 3、 function

1、 background

The camera took pictures of many days , Are stored in a folder .

as follows :

The current requirement is based on the modification time of the file , Reclassify the files to the corresponding date folder .

such as 1641975447.0557504.jpg Was modified on 2022‎ year ‎1‎ month ‎12‎ Japan ‎ Wednesday ,‏‎16:17:27
Will 1641975447.0557504.jpg To classify as “./2022‎-0‎1-‎12/‎” Under the table of contents .

Here's the picture :

2、 Code

recatefile.py The script is as follows :

# -*- coding: UTF8 -*-
# jn10010537
# recatefile.py
# Reclassify according to the date when the file was written to the disk 

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved