daily pastebin goal
55%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Looking for a way to rename lots of files at once
  2. for file in *; do
  3.     new=${file//-/ - };
  4.     new=${new//+/ };
  5.     if [ "$file" != "$new" ]; then
  6.         mv "$file" "$new";
  7.     fi;
  8. done
  9.    
  10. for a in * ; do
  11.     mv $a $(echo $a | sed -s 's/-/ - /' -e 's/+/ /')
  12. done
  13.    
  14. for f in `ls` ; do
  15.     mv $f $(echo $f | sed -s 's/-/ - /' | tr '+' ' ')
  16. done
  17.    
  18. for f in `ls` ; do
  19.     n=$(echo $f | tr -s 's/-/ - /' | tr '+' ' ')
  20.     if [ $f != $n ]; then
  21.         mv $f $n
  22.     fi
  23. done
  24.    
  25. for FILE in `find . -maxdepth 1 -type f`; do mv "$FILE" "`echo "$FILE" | sed -e 's/-/ - /g' -e 's/+/ /g'`"; done;
  26.    
  27. printf "%sn" * |
  28. sed 'h;y/+/ /;s/-/ - /g;x;G;/(.*)n(1)/d;s/(.*)n(.*)/mv -v '''1''' '''2'''/' |
  29. sh
  30.    
  31. for file in *
  32. do
  33.   newFile=${file//+/ }
  34.   newFile=${newFile//-/ - }
  35.   mv "$file" "$newFile"
  36. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top