Just want to chronicle l some really neat, time saving tricks I’ve picked up today for handling files in bash.
The first, how to use the find command:
Easy enough, right?
Let’s use find and cp to back up a bunch of text files:
NOTE: the above assumes that there is only one text file in each directory, and will create a file in the same directory being a copy of whatever file it is that the find command returns.
Let’s string find to sed, and use sed to replace all instances of “.ogg” to “.mp3” within a collection of text files:
Let’s also use find and LAME together to convert a batch of wav files to mp3 files (I recommend you run the following from within a screen session):
NOTE: The above will create mp3 files in the form of “somefile.wav.mp3” in the same directory that “somefile.wav” is located.
Let’s use find to delete the remaining wave format files:
The above commands can save hours of messing around with a file manager.