Skip to content

Instantly share code, notes, and snippets.

@cdparra
Last active October 19, 2015 22:05
Show Gist options
  • Save cdparra/6d48f52a03655873a4d4 to your computer and use it in GitHub Desktop.
Save cdparra/6d48f52a03655873a4d4 to your computer and use it in GitHub Desktop.
Filter files in a directory, list other with similar name but slight pattern change and then remove them
# Filter files that contains (1) in their names (copies). Remove this from the name and then use this delete the original files
ls *.jpg | cut -d. -f1 | cut -d"(" -f1 | awk '{print $1".JPG"}' | xargs rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment