Advertisement
zinch

Rename Files with Spaces

Feb 23rd, 2016
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.22 KB | None | 0 0
  1. SAVEIFS=$IFS
  2. IFS=$(echo -en "\n\b")
  3. for file_name in $(ls *.ogg)
  4. do
  5.     file_number=$(echo "$file_name" | cut -d' ' -f 7 | cut -d '.' -f 1)
  6.     mv $file_name $(printf "Track_%03d.ogg\n" $file_number)
  7. done
  8. IFS=$SAVEIFS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement