I have a lot of documents on my drive with the .odt extension. Example:
However, I find the .odt distracting when browsing through a lot of documents.
So, I managed to write this script (removeODT.sh):
#!/bin/bash
for file in *.odt
do
mv "$file" "${file%.odt}"
done
Which removes the .odt extension from .odt files in the directory that I execute the script in.
e.g. Open terminal in ~/Desktop/MyDocuments and type
sh /home/user1/BashScripts/removeODT.sh
This removes the .odt extension from all the files in MyDocuments.
But after removing the extension, I can't use the files on other operating systems, and also can't search the contents of the document with loook
.
So to remedy that, I created a second script to add the .odt extension back when needed (addODT.sh):
#!/bin/bash
for file in *
do
mv "$file" "${file%}.odt"
done
Now, what I'd like to do is to make those scripts change every document in the specified parent directory and all of its sub-directories instead of only a single directory as they do now.
e.g. "Remove .odt extensions from files in Documents and all of its sub-folders "
This would allow me to change all of my files with a single script without having to execute the script for each folder separately. But I'm quite new to this so I have no idea how to go about it.
P.S. An ideal solution would be to hide the .odt extension in Nautilus but as far as I know it's not possible.