0

enter image description hereI had to download videos from DVR in more trials. After that files were manually arranged by alphabetical order into few groups, in each group by numbers. It is necessary to have videos in former order and also to keep information about content for each file.

current situation:

a_1.(info about content).avi a_2.(info about content)avi ... a_101.(info about content).avi b_1.(info about content).avi b_2.(info about content).avi ... b_350.(info about content).avi .. .. ..

It should look like:

1.(info about content).avi 2.(info about content).avi 3.(info about content).avi....500.(info about content).avi

Is there any way how to do it automatically?

  • Does the (info about content) contain any spaces? – Stefan Hamcke Apr 6 at 9:47
  • No, it doesn't. – Jakub Horak Apr 6 at 10:12
0

Try the following command

i=1; for file in $(ls -v *.avi); do echo "$file --> $i.${file#*.}"; i=$((i+1)); done | less

Provided the (info about content) does not contain any space or newline characters, this shows you a mapping of source file to target file, so you can overlook if this is what you want. If you are happy with it, execute the line

i=1; for file in $(ls -v *.avi); do mv "$file" "$i.${file#*.}"; i=$((i+1)); done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.