A file named file.lst has been created on a linux machine that contains a list of directory names separated by a new line like the following:
Write a bash script which will iterate through the directory names and create them as subdirectories in /var/www/html/
for file in `find start -type f -print` do echo $file fname=`basename $file` dir=`dirname $file` if [[ $fname =~ "file" ]] then # move it if [[ $dir =~ "dir1" ]] then mv $file var/www/html/dir1 elif [[ $dir =~ "dir2" ]] then mv $file var/www/html/dir2 else echo "unmatched dir $dir" fi fi done
I really dont even knw if i'm on the right path.
This post has been edited by GunnerInc: 20 June 2012 - 05:50 PM
Reason for edit:: Added code tags