Advertisement
Guest User

Append Folder name to the files in the folder

a guest
Mar 4th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. home="$PWD"
  4.  
  5. find * -maxdepth 1 -name "*" -type d |\
  6. while read dir;
  7. do
  8.   cd "$dir"
  9.   for file in *
  10.   do
  11.     mv "$file" "$dir-$file"
  12.   done
  13.   cd "$home"
  14. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement