2 added missing -n for sed; added missing -N for file
source | link

The basic idea is to use the file utility to determine the type of each file, and filter on video files.

find /some/directory -type f -exec file -N -i -- {} + |
sed -n 's!: video/[^:]*$!!p'

This prints the names of all files in /some/directory and its subdirectories recursively whose MIME type is a video type.

The file command needs to open every file, which can be slow. To speed things up:

  • Restrict the command to the directory trees where it's likely to be, such as /tmp, /var/tmp and your home directory.
  • Restrict the search to files whose size is in the right ballpark, say at least 10MB.
  • Restrict the search to files whose modification time is in the right ballpark. Note that downloading the file may have set its modification time to the time of download or preserved the time, depending on what program you used to download (and with what settings). You may also filter on the inode change time (ctime), which is the time the file was last modified or moved around (created, renamed, etc.) in any way.

Here's an example which constrains the modification time to be at least 60 days ago and the ctime to be no more than 100 days ago.

find /tmp /var/tmp ~ -type f -size +10M \
     -mtime +60 -ctime -100 \
     -exec file -N -i -- {} + |
sed -n 's!: video/[^:]*$!!p'

The basic idea is to use the file utility to determine the type of each file, and filter on video files.

find /some/directory -type f -exec file -i -- {} + |
sed 's!: video/[^:]*$!!p'

This prints the names of all files in /some/directory and its subdirectories recursively whose MIME type is a video type.

The file command needs to open every file, which can be slow. To speed things up:

  • Restrict the command to the directory trees where it's likely to be, such as /tmp, /var/tmp and your home directory.
  • Restrict the search to files whose size is in the right ballpark, say at least 10MB.
  • Restrict the search to files whose modification time is in the right ballpark. Note that downloading the file may have set its modification time to the time of download or preserved the time, depending on what program you used to download (and with what settings). You may also filter on the inode change time (ctime), which is the time the file was last modified or moved around (created, renamed, etc.) in any way.

Here's an example which constrains the modification time to be at least 60 days ago and the ctime to be no more than 100 days ago.

find /tmp /var/tmp ~ -type f -size +10M \
     -mtime +60 -ctime -100 \
     -exec file -i -- {} + |
sed 's!: video/[^:]*$!!p'

The basic idea is to use the file utility to determine the type of each file, and filter on video files.

find /some/directory -type f -exec file -N -i -- {} + |
sed -n 's!: video/[^:]*$!!p'

This prints the names of all files in /some/directory and its subdirectories recursively whose MIME type is a video type.

The file command needs to open every file, which can be slow. To speed things up:

  • Restrict the command to the directory trees where it's likely to be, such as /tmp, /var/tmp and your home directory.
  • Restrict the search to files whose size is in the right ballpark, say at least 10MB.
  • Restrict the search to files whose modification time is in the right ballpark. Note that downloading the file may have set its modification time to the time of download or preserved the time, depending on what program you used to download (and with what settings). You may also filter on the inode change time (ctime), which is the time the file was last modified or moved around (created, renamed, etc.) in any way.

Here's an example which constrains the modification time to be at least 60 days ago and the ctime to be no more than 100 days ago.

find /tmp /var/tmp ~ -type f -size +10M \
     -mtime +60 -ctime -100 \
     -exec file -N -i -- {} + |
sed -n 's!: video/[^:]*$!!p'
1
source | link

The basic idea is to use the file utility to determine the type of each file, and filter on video files.

find /some/directory -type f -exec file -i -- {} + |
sed 's!: video/[^:]*$!!p'

This prints the names of all files in /some/directory and its subdirectories recursively whose MIME type is a video type.

The file command needs to open every file, which can be slow. To speed things up:

  • Restrict the command to the directory trees where it's likely to be, such as /tmp, /var/tmp and your home directory.
  • Restrict the search to files whose size is in the right ballpark, say at least 10MB.
  • Restrict the search to files whose modification time is in the right ballpark. Note that downloading the file may have set its modification time to the time of download or preserved the time, depending on what program you used to download (and with what settings). You may also filter on the inode change time (ctime), which is the time the file was last modified or moved around (created, renamed, etc.) in any way.

Here's an example which constrains the modification time to be at least 60 days ago and the ctime to be no more than 100 days ago.

find /tmp /var/tmp ~ -type f -size +10M \
     -mtime +60 -ctime -100 \
     -exec file -i -- {} + |
sed 's!: video/[^:]*$!!p'