# This program will move files from directories to identical directories in # another path. See the IMPORTANT comment below. This program must be # modified before it is run. tput clear print "Type in the directory you would like to move the files to starting with a [/] and ending with a [/] [e.g. /xxxx/yyyy/zzzz/] : \c" read input print "\n The directory you just entered is: ${input} \n" print "If correct Press Enter to Continue; if incorrect press the and keys simultaneously" read for i in $(li -OdRa) do cd ${i} # IMPORTANT - you must modify the cut command at the [-f] field option based on the number of directory levels [e.g. /ww/xxx/yy/zzzz/ would be the 6th level; # root level is before the slash, ww is lvl 2, xxx is lvl 3, yy is lvl 4, zzzz is lvl 5, and lvl 6 is after the trailing slash] pwd | cut -d"/" -f4,5,6 | read directory #### MODIFY THE NUMBER AFTER -f ####### print "The files in: ${i} will move to: ${input}${directory}" print "Press Enter to Continue" # read # This program creates a directory in the input directory if one does not # already exist. if test -d ${input}${directory} then print "The directory: ${input}${directory} already exists - continuing" # exit else mkdir ${input}${directory} print "Making the directory ${directory} in the path ${input}" # read fi # mv * ${input}${directory} done