I would like to write a script that finds duplicate mp3's by content and not bf file name. I am wondering how one goes about seeing a file types inner data for the sake of comparison. Thank you.
相关问题
- How to get the return code of a shell script in lu
- JQ: Select when attribute value exists in a bash a
- Invoking Mirth Connect CLI with Powershell script
- Emacs shell: save commit message
- bash print whole line after splitting line with if
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- In IntelliJ IDEA, how can I create a key binding t
- Check if directory exists on remote machine with s
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Reverse four length of letters with sed in unix
- Launch interactive SSH bash session from PHP
- BASH: Basic if then and variable assignment
I use this script for my photo but it can be used for other files.
newfiles
../garbage
newfiles
Caution: This script does not compare file content, but it detects files having same size & name (this is OK for camera files). My other answer is based on content comparison (
md5sum
).cmp
can be used to compare binary files.cmp
command returns0
if the files are same or else-1
.If the files are really byte-to-byte equivalent, you can start searching for files of the same size. If their size is the same, you can investigate further (e.g. compare their
md5sum
). If the files just contain the same song, but use a different codec/compression/whatever, bash is probably not the right tool for the task.This first command line lists all files having same size and same
md5sum
from the current directoryThe second command line is
md5sum
solely for the files having the same sizeTherefore it is also more complex
Some explanations