Update README.md, new filename formatting
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
@@ -20,10 +20,11 @@ def rename_file(current_name, splitted, settedPath):
|
||||
if found_number is None:
|
||||
continue
|
||||
found_number = found_number.group()[ pattern[1]:pattern[2] ]
|
||||
new_name = "{:02d}{}".format(int(found_number), splitted[1]) # Новое имя файла
|
||||
current_path = "{}\\{}".format(settedPath, current_name) if settedPath is not None else realpath(current_name) # Получаем путь до файла
|
||||
new_path = "{}{}{}".format(current_path.replace(current_name, ""), found_number, splitted[1]) # Новый путь до файла
|
||||
new_path = "{}{}".format(current_path.replace(current_name, ""), new_name) # Новый путь до файла
|
||||
rename(current_path, new_path) # Переименовываем файл
|
||||
print("\"{}\" successfully renamed to \"{}\".".format(current_name, found_number + splitted[1]))
|
||||
print("\"{}\" successfully renamed to \"{}\".".format(current_name, new_name))
|
||||
|
||||
|
||||
def main(folder):
|
||||
|
||||
Reference in New Issue
Block a user