SHARE
TWEET

mp3 loader for sansa on Linux

a guest Jan 31st, 2011 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # grabs mp3's from last year and copies them to recentmp3 folder in home directory
  4.  
  5. # change file separator so spaces work
  6. SAVEIFS=$IFS
  7. IFS=$(echo -en "\n\b")
  8.  
  9. # make directory if needed
  10. cd $HOME
  11. mkdir recentmp3
  12.  
  13. # go to my mp3s (you'll want to update this to where yours are
  14. cd /media/minion/multimedia/audio/legalmp3/amazon
  15. for f in *
  16. do
  17.   cd $f
  18.   for s in *
  19.   do
  20.     cd $s
  21.     for m in *.mp3
  22.     do      # copy mp3's one year old or less
  23.       find $m -mtime -365 -exec echo caching file {} \;
  24.       find $m -mtime -365 -exec cp $m $HOME/recentmp3/{} \;
  25.     done
  26.     cd ..
  27.   done
  28.   cd ..
  29. done
  30.  
  31. # copy mp3s to player
  32. cd $HOME/recentmp3
  33. for f in *.mp3
  34. do
  35.   newf=`echo $f | sed s/*//g` # sansa doesn't like asterices in filenames
  36.   echo copying cached file $f to player
  37.   cp $f /media/SANSA\ CLIPP/MUSIC/$newf
  38. done
  39.  
  40. # clean up mp3's
  41. cd $HOME
  42. rm -rf recentmp3
  43.  
  44. # return to orig file separators
  45. IFS=$SAVEIFS
  46.  
  47. echo DONE
RAW Paste Data
Top