bash script for folding



  • There's plenty of files. dir1, dir2, dir3 etc., total number 100-200, for example. I need a violin that will create a type of folder around them. dir1fold, dir2fold, dir3fold(grunts to say the name of the previous folder and adds the prefix fold) and, ideally, carry each dir I'm in my own way. dirfold



  • for dir in *; do
        if [ -d "$dir" ]; then
            newdir="${dir}fold"    
            mkdir "$newdir"
            mv "$dir" "$newdir"
        fi
    done
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2