echo Enter the name of the directory you want to tar read directory_path echo $directory_path # echo Enter the name of the file you dont want to tar # read invalid # echo $invalid invalid = .backup cd $directory_path count = ls -lst | wc -l count = 'expr $count - 1' while [ $count -gt 0 ] do if [ $invalid -ne .backup ] then tar -cvfw /.../neregion.ibm.com/fs/home/fcrespo/pan.tar $directory_path fi count='echo $count - 1 | bc' done