So that was all I needed to jog the creative juices. I did a comparison on a WMA with and without DRM and found a expression that seems to work well. Then a few hundred re-writes later I created this, hope it is useful for someone else too!
Given a directory this will go through and move all DRM files (well maybe not all types, known to work with WMA) to a subdirectory called 'DRM' of the provided directory. It respects found locations.
Example Output(if the script is called move_drm):
Quote:
[me@localhost ~]$move_drm /home/me/repository
FOUND DRM IN: 07 Taiyed.wma
Creating folder '/home/me/repository/DRM/Work/Grassroots'
Moving '/home/me/repository/Work/Grassroots/07 Taiyed.wma' to '/home/me/repository/DRM/Work/Grassroots/'
FOUND DRM IN: 05 Omaha Stylee.wma
Destination Folder Exists
Moving '/home/me/repository/Work/Grassroots/05 Omaha Stylee.wma' to '/home/me/repository/DRM/Work/Grassroots/'
|
Code:
#!/bin/bash
if [ -z "$1" ]; then
echo usage: $0 directory
exit
fi
if [ -d "$1" ]
then
directory="$1"
else
echo usage: $0 directory
echo " ERROR: $1 is not a valid directory!"
exit
fi
clear
grep -rl "sbp=DRM" ${directory}/* | grep -v DRM | while read line
do
echo -e "\n\nFOUND DRM IN: ${line##*/}"
drm_dir=${line%/*}
drm_dir=${drm_dir##$directory}
drm_dir=$directory/DRM${drm_dir}
if [ -d "$drm_dir" ]
then
echo " Destination Folder Exists"
else
echo " Creating folder '$drm_dir'"
mkdir -p "$drm_dir"
fi
echo " Moving '$line' to '$drm_dir/'"
mv -f "$line" "$drm_dir/"
done
echo -e "\n*** COMPLETE ***\n"
Best Regards!