SHOW:
|
|
- or go back to the newest paste.
| 1 | # Generating | |
| 2 | mkdir -p /tmp/dir1/a\ subdir | |
| 3 | echo good > /tmp/dir1/foo | |
| 4 | echo yes > /tmp/dir1/so\ long\ file\ name\ with\ spaces | |
| 5 | echo bar > /tmp/dir1/a\ subdir/bar | |
| 6 | ||
| 7 | mkdir -p /tmp/dir\ 2/a\ long\ name\ for\ a\ subdir | |
| 8 | echo good > /tmp/dir\ 2/a\ long\ name\ for\ a\ subdir/The\ Bar | |
| 9 | echo yes > /tmp/dir\ 2/a\ long\ name\ for\ a\ subdir/The\ Foo | |
| 10 | echo bar > /tmp/dir\ 2/cool | |
| 11 | ||
| 12 | # Verifying if the files have the same content | |
| 13 | find /tmp/dir1/ -type f -exec md5sum "{}" \; |cut -d\ -f1 |sort > /tmp/hashes_dir1
| |
| 14 | - | # no output |
| 14 | + | |
| 15 | diff /tmp/hashes_dir1 /tmp/hashes_dir2 | |
| 16 | # no output | |
| 17 | ||
| 18 | # trying the suggestion: | |
| 19 | diff -q /tmp/dir1 /tmp/dir\ 2 | |
| 20 | # Somente em /tmp/dir 2: a long name for a subdir | |
| 21 | # Somente em /tmp/dir1: a subdir | |
| 22 | # Somente em /tmp/dir 2: cool | |
| 23 | # Somente em /tmp/dir1: foo | |
| 24 | # Somente em /tmp/dir1: so long file name with spaces | |
| 25 | ||
| 26 | # Showing the correspondent files: | |
| 27 | find /tmp/dir1 -type f -exec md5sum "{}" \; > /tmp/hashes_dir
| |
| 28 | find /tmp/dir\ 2 -type f -exec md5sum "{}" \; >> /tmp/hashes_dir
| |
| 29 | cat /tmp/hashes_dir |sort | |
| 30 | # c157a79031e1c40f85931829bc5fc552 /tmp/dir1/a subdir/bar | |
| 31 | # c157a79031e1c40f85931829bc5fc552 /tmp/dir 2/cool | |
| 32 | # d7f986677d9f563bd1794b09d82206a3 /tmp/dir1/foo | |
| 33 | # d7f986677d9f563bd1794b09d82206a3 /tmp/dir 2/a long name for a subdir/The Bar | |
| 34 | # eb4585ad9fe0426781ed7c49252f8225 /tmp/dir1/so long file name with spaces | |
| 35 | # eb4585ad9fe0426781ed7c49252f8225 /tmp/dir 2/a long name for a subdir/The Foo |