fix: sort file by name

This commit is contained in:
Starnakin 2025-05-22 17:52:04 +02:00
parent bb29eb2b73
commit df05678ddc
2 changed files with 9 additions and 2 deletions

View File

@ -42,7 +42,10 @@ class Path():
def get_dirs(self) -> list[Path]:
dirs: list[Path] = []
for element in os.listdir(self.get_absolute_path()):
elements = os.listdir(self.get_absolute_path())
elements.sort()
elements.reverse()
for element in elements:
path: Path = Path(self._absolute_path, element)
if (os.path.isdir(path.get_absolute_path())):
dirs.append(path)
@ -50,7 +53,10 @@ class Path():
def get_files(self) -> list[Path]:
files: list[Path] = []
for element in os.listdir(self.get_absolute_path()):
elements = os.listdir(self.get_absolute_path())
elements.sort()
elements.reverse()
for element in elements:
path: Path = Path(self._absolute_path, element)
if (os.path.isfile(path.get_absolute_path())):
files.append(path)

View File

@ -34,6 +34,7 @@ def main():
copy_info: dict[str, str] = get_copy_info(copy_path)
files: list[str] = [os.path.join(input_folder, f) for f in os.listdir(input_folder)]
files = [f for f in files if os.path.isfile(f) and f.endswith(".NEF")]
files.sort()
with Bar("copying...", max=len(files)) as bar:
for file in files:
with open(file, 'rb') as f: