Skip to content

Instantly share code, notes, and snippets.

@Sam-R
Created April 5, 2017 10:34
Show Gist options
  • Save Sam-R/04087ffe8e73a7eb63b1cc426ceb55db to your computer and use it in GitHub Desktop.
Save Sam-R/04087ffe8e73a7eb63b1cc426ceb55db to your computer and use it in GitHub Desktop.
Find files with the same name but different extensions in a directory
# Find duplicate filenames
## Find everything in the Pictures directory with the same file name excluding extension.
ls -1 ~/Pictures/ | sed 's/\(.*\)\..*/\1/' | sort | uniq -c | grep -v " 1 "
# Find unique filenames
## Find everything in the Pictures directory without the same file name excluding extension.
ls -1 ~/Pictures/ | sed 's/\(.*\)\..*/\1/' | sort | uniq -c | grep -v " 2 "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment