Skip to content

Instantly share code, notes, and snippets.

@rogovski
Created April 3, 2017 20:48
Show Gist options
  • Select an option

  • Save rogovski/97e649ddfe5bf6c592db6f42ea0e59f1 to your computer and use it in GitHub Desktop.

Select an option

Save rogovski/97e649ddfe5bf6c592db6f42ea0e59f1 to your computer and use it in GitHub Desktop.
shell snippets
# remove all files in the current directory with 'copy' in the name
ls | grep .*copy | xargs rm
# remove files - works with whitespace in filename
find -type f -name '*.sql' -mtime +15 -print0 | xargs -0 rm
# replace white space in file names with underscore
for f in *\ *; do mv "$f" "${f// /_}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment