Reputation: 779
I have a folder with a number of subfolders. Each of the subfolders consists of several files without extension. I need to add extension .cel to each file in subfolders.
How can I do it using bash?
Upvotes: 0
Views: 50
Reputation: 77085
If you have rename
then using that with find
should do the trick:
find . -type f -exec rename -v 's/$/\.cel/' {} \;
Upvotes: 1
Reputation: 289515
find
to the rescue:
find /your/folder -type f -exec mv {} {}.cel \;
Explanation: find
obtains all files inside the /your/folder
structure. From all the results obtained, it performs the mv
command. It makes the file XXX
to be moved to XXX.cel
, which is another way of renaming it.
Upvotes: 2