mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 02:30:45 +00:00
Script for finding files with a given type
This commit is contained in:
13
files-with-type
Executable file
13
files-with-type
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Find all files with a given MIME type.
|
||||
#
|
||||
# e.g.
|
||||
# $ files-with-type text/x-shellscript k8s infra
|
||||
#
|
||||
# Assumes `find`, `xargs`, and `file` are all installed.
|
||||
|
||||
mime_type=$1
|
||||
shift
|
||||
|
||||
find "$@" -print0 -type f |xargs -0 file --mime-type | grep "${mime_type}" | sed -e 's/:.*$//'
|
||||
Reference in New Issue
Block a user