티스토리 뷰

Series

[Python] Video File Renamer

More Code 2019. 4. 25. 15:46


# Video File Renamer
# Rename video files so that various sets of video files can be sorted properly.

import os


def main():
path = 'd:\\Down\\z'
for root, dirs, files in os.walk(path):
step = 1000 / len(files)
files.sort()
count = 0
for item in files:
prefix = "{0:0>4.0f}".format(step * count + step / 3)
os.rename(os.path.join(root, item), os.path.join(root, "{0} {1}".format(prefix, item)))
count += 1


if __name__ == "__main__":
main()





'Series' 카테고리의 다른 글

[Sandboxie] Detect Registry Changes 2  (0) 2018.07.09
[Sandboxie] Detect Registry Changes 1  (0) 2018.07.09
[Sandboxie] Create Sandboxed Shortcut  (0) 2018.07.09
[Eclipse] Set C++ -static Option  (0) 2018.07.02
[Eclipse] Set C++ Toolchain  (0) 2018.07.02
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함