All pastes #403162 Raw Edit

Sports

public text v1 · immutable
·published 2007-03-20 05:33 UTC
rendered paste body
################################################################################################
# !/bin/bash                                                                                   #
# change-file-names.sh                                                                         #
# 01-05-2005                                                                                   #
#rename the files removing the numbers.                                                        #
#                                                                                              #
#                                                                                              #
# USE AT YOUR OWN RISK!!!!!!!!!!!!!                                                            #
# Author Sports                                                                                #
################################################################################################




 echo "Please enter the full path to your files EG: /home/mick/music" ; 
     read path ;
       cd $path;
        echo "Changing to directory..." ;
 pwd ;
         echo "Would you like to veiw all files starting with numbers in this dir y/n" ;
         read answer;
                   if [ $answer = y ] ; then
                       ls [0-9]*.mp3 ;
 
              else
                  ls |grep mp3 |wc -l ;
                    echo "mp3's Found in this dir" ;
              fi
    
    
                    echo " Would you like to start renaming these files ? y/n" ;
                      read input;
                    
                 if [ $input = y ] ; then
                    
                   for I in [0-9 -]*mp3;  do rename -v 's/^[0-9 -]* //' *mp3 ; done


                else
                      echo " Nothing to be done here quitting ..." ;
                 exit
                    fi
   
                   echo " This is how your new file names look" ;
                   ls |grep mp3 ;
   exit