S
S
Sergey Burduzha2020-10-22 13:56:24
linux
Sergey Burduzha, 2020-10-22 13:56:24

How to rename files and folders recursively in Linux?

Good afternoon.
There is a folder with a course.
Inside there are files like:

1.lessons1
  1.intro.mp4
2.lesson2
  2.filename.mp4
10.lesson10
  1.filename2.mp4


And the problem is that they are not sorted correctly, after the one there is a folder with the number 10.

And you need, if there is one number in the file or folder header, then put a zero.

And so go through all the files and folders.

Thanks in advance for the hint.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max, 2020-10-22
@serii81

maybe "natural sort order" without renaming will suit you? "sort -1v"
https://stackoverflow.com/questions/22948042/bash-...

V
Victor Taran, 2020-10-22
@shambler81

ls -v
wrote in more detail here
https://klondike-studio.ru/blog/bitrixtar/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question