renum-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
renum.py ADDED
@@ -0,0 +1,31 @@
1
+ from pathlib import Path
2
+ import sys
3
+
4
+ def main():
5
+ # 対象の拡張子
6
+ extensions = {".jpg", ".jpeg", ".png", ".webp"}
7
+
8
+ # カレントディレクトリから対象ファイルを収集してソート
9
+ files = [f for f in Path(".").iterdir() if f.is_file() and f.suffix.lower() in extensions]
10
+ files.sort(key=lambda x: x.name)
11
+
12
+ if not files:
13
+ print("対象の画像ファイルが見つかりません。")
14
+ return
15
+
16
+ # 一時リネームで競合を防ぐ
17
+ temp_files = []
18
+ for f in files:
19
+ tmp = f.with_name(f"tmp_{f.name}")
20
+ f.rename(tmp)
21
+ temp_files.append((tmp, f.suffix.lower()))
22
+
23
+ # ゼロ埋めで連番リネーム
24
+ for i, (tmp, ext) in enumerate(temp_files, start=1):
25
+ new_name = f"{i:03d}{ext}"
26
+ tmp.rename(new_name)
27
+
28
+ print(f"{len(files)} 件のファイルを連番にリネームしました。")
29
+
30
+ if __name__ == "__main__":
31
+ main()
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: renum-cli
3
+ Version: 0.1.0
4
+ Summary: Image sequential renamer tool
5
+ Requires-Python: >=3.7
6
+ Description-Content-Type: text/markdown
@@ -0,0 +1,6 @@
1
+ renum.py,sha256=_QleupAW18WuCyvEptKr3y273-3oU4hjwtTjU2C_h7g,945
2
+ renum_cli-0.1.0.dist-info/METADATA,sha256=6gkvWa-5hZwiV082mF-qUPxX3x4FBxlIoxaTedv3Qow,155
3
+ renum_cli-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
4
+ renum_cli-0.1.0.dist-info/entry_points.txt,sha256=_OnHRbh-s6o_HVYf2GTPOpYN0WNkddmXvEEiTvNwk14,37
5
+ renum_cli-0.1.0.dist-info/top_level.txt,sha256=rfzh7ogNOo6x3J4u99AOB51IdCTSpE8U0slHpJJf3f4,6
6
+ renum_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ renum = renum:main
@@ -0,0 +1 @@
1
+ renum