Skip to content

Instantly share code, notes, and snippets.

@arirusso
Created June 6, 2013 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arirusso/5723281 to your computer and use it in GitHub Desktop.
Save arirusso/5723281 to your computer and use it in GitHub Desktop.
One-liner to remove spaces from the names of all files in the current directory
#!/bin/sh
#
# Remove spaces from the names of all files in the current directory
#
ls -1 | while read file; do new_file=$(echo $file | sed s/\ //g); mv "$file" "$new_file"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment