Skip to content

Instantly share code, notes, and snippets.

@alekseypotapov-dev
Created May 4, 2018 10:27
Show Gist options
  • Save alekseypotapov-dev/a94be3b316b6dac06c8115e211f184dc to your computer and use it in GitHub Desktop.
Save alekseypotapov-dev/a94be3b316b6dac06c8115e211f184dc to your computer and use it in GitHub Desktop.
Change spaces to underscore for all filenames in current folder
for f in *\ *; do mv "$f" "${f// /_}"; done
@opotapov-sygic
Copy link

opotapov-sygic commented Aug 17, 2018

for f in *; do mv "$f" "${f/foo/bar}"; done
# for all items in current directory replace all "foo" occurrences with "bar"

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