处理文件名中的时间戳和日期戳
date2name的Python项目详细描述
这个python脚本添加、删除和管理文件名中的日期和时间戳。
2013-05-09 a file name with ISO date stamp in name – tag1.jpg
2013-05-09T16.17 file name with time stamp – tag3.csv
- 用法:
- 日期2名称[选项]文件…
默认情况下,date2name获取匹配文件的修改时间 和目录,并添加标准iso 8601+格式的日期戳 年-月-日(http://datestamps.org/index.shtml)开始于 文件名或目录名。 如果找到一个现有的时间戳,它的样式将被转换为 已选择ISO日期戳格式,但数字保持不变。 使用示例文件名“file”执行,结果如下 “2008-12-31_文件”。 注:ISO 8601中定义的其他+小时之间的分隔符, 分和秒不是冒号而是点。冒号引起 不同文件系统上的几个问题及其替换 带有点的(旧的)DIN5008版本。
运行date2name–使用提示帮助
- 选项:
-h, --help show this help message and exit -d, --directories modify only directory names -f, --files modify only file names -C, --compact use compact datestamp (YYYYMMDD) -M, --month use datestamp with year and month (YYYY-MM) -w, --withtime use datestamp including seconds (YYYY-MM-DDThh.mm.ss) -m, --mtime take modification time for datestamp [default] -c, --ctime take creation time for datestamp --delimiter overwrite delimiter string --nocorrections do not convert existing datestamps to new format -q, --quiet do not output anything but just errors on console -v, --verbose enable verbose mode -s, --dryrun enable dryrun mode: just simulate what would happen, do not modify files or directories --version display version and exit
请阅读https://github.com/novoid/date2name/了解更多信息和说明。