Answer the question
In order to leave comments, you need to log in
How to recursively change the extension of files in Unix?
It is necessary to rename a mountain of files lying in subdirectories nested in subdirectories.
Linux (bash) and FreeBSD (csh) systems.
The extension is exactly the same (and the same). We also change to exactly the same thing. Without any additional conditions.
How?
Answer the question
In order to leave comments, you need to log in
An example to rename all .bak files to .old files in nested directories:
Note: For debugging purposes, rename commands will be printed to the screen due to the presence of the echo command.
After debugging, you can remove echo from the command and then the renaming of the files will actually be performed.
Read the manuals:
man find
man rename
#меняет 1.mp3 и тд на 01.mp3 и тд. в каталоге ./renamed если sed слишком сложно...
#!/bin/bash
#cd ~
mkdir -p renamed
j=1
for i in *.mp3
do
cp $i ./renamed/"0"$j".mp3"
let j=$j+1
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question