#coding:utf8
import os,time

directory = "d:/scrapy tutorial/"
t = []
d = {}
for filename in os.listdir(directory):
        path = directory + filename
        time1 = time.ctime(os.path.getmtime(path))
        d[time1] = filename
        t.append(time1)
n = 1
for i in sorted(t):
        fn = directory + d[i]
        new_fn = directory + str(n) + '. ' + d[i]
##        if n<10:
##                new_fn = directory + d[i][1:]
##        else:
##                new_fn = directory + d[i][2:]
        os.rename(fn, new_fn)
        n += 1

  临时写的一个脚本,可以用在那些不支持按时间排序、默认按[0-9a-Z]排序的系统上

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-23
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案