Skip to content

Instantly share code, notes, and snippets.

@david-pm
Created May 30, 2016 20:11
Show Gist options
  • Select an option

  • Save david-pm/c13dc333ebd210bc67de59b013b82b5e to your computer and use it in GitHub Desktop.

Select an option

Save david-pm/c13dc333ebd210bc67de59b013b82b5e to your computer and use it in GitHub Desktop.
replaces spaces with underscores in file names if rename utility is unavailable
#!/bin/bash
# replace spaces with underscores in file names
ls | while read file
do
mv "$file" "$(echo "$file" | sed -e 's/\ /_/g')"
done
@david-pm
Copy link
Copy Markdown
Author

Some systems dont have the rename command available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment