Skript leiab dublikaat failid: Difference between revisions

From ICO wiki
Jump to navigationJump to search
(Created page with '#!/bin/bash DIRS=$@ find $DIRS -type f ! -empty -exec md5sum {} \; > checksums.txt cat checksums.txt | awk '{ print $1 }' | sort | uniq -d > duplicates.txt grep -f duplicates.tx…')
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
#!/bin/bash
#!/bin/bash
DIRS=$@
DIRS=$@
find $DIRS -type f ! -empty -exec md5sum {} \;  > checksums.txt
find $DIRS -type f ! -empty -exec md5sum {} \;  > checksums.txt
cat checksums.txt | awk '{ print $1 }' | sort | uniq -d > duplicates.txt
cat checksums.txt | awk '{ print $1 }' | sort | uniq -d > duplicates.txt
grep -f duplicates.txt checksums.txt | sort
grep -f duplicates.txt checksums.txt | sort




Line 9: Line 9:


bash dublikaadid.sh /var /home
bash dublikaadid.sh /var /home
Kui soovid otsida ka tühje faile võta -empty skriptist välja

Latest revision as of 16:48, 30 December 2010

#!/bin/bash
DIRS=$@
find $DIRS -type f ! -empty -exec md5sum {} \;  > checksums.txt
cat checksums.txt | awk '{ print $1 }' | sort | uniq -d > duplicates.txt
grep -f duplicates.txt checksums.txt | sort


Skripti käivitades peab andma käsu, millistest kataloogidest dublikaat faile otsitakse, näiteks:

bash dublikaadid.sh /var /home

Kui soovid otsida ka tühje faile võta -empty skriptist välja