How to move all audio files to other directory based on file content, ignoring the filename
This command will identify all audio files such as MP3s in a directory recursively using the file
command (looking for audio/*
MIME types) and move those to a different directory.
example.sh
mkdir -p ../Audio && find . -type f -exec sh -c '
case $( file -bi "$1" ) in (audio/*) exit 0; esac
exit 1' sh {} \; -exec mv -v --backup=numbered {} ../Audio \;
Based on this StackExchange post. Also see How to move all images to other directory based on file content, ignoring the filename and How to move all videos to other directory based on file content, ignoring the filename
Check out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow