Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generating
- mkdir -p /tmp/dir1/a\ subdir
- echo good > /tmp/dir1/foo
- echo yes > /tmp/dir1/so\ long\ file\ name\ with\ spaces
- echo bar > /tmp/dir1/a\ subdir/bar
- mkdir -p /tmp/dir\ 2/a\ long\ name\ for\ a\ subdir
- echo good > /tmp/dir\ 2/a\ long\ name\ for\ a\ subdir/The\ Bar
- echo yes > /tmp/dir\ 2/a\ long\ name\ for\ a\ subdir/The\ Foo
- echo bar > /tmp/dir\ 2/cool
- # Verifying if the files have the same content
- find /tmp/dir1/ -type f -exec md5sum "{}" \; |cut -d\ -f1 |sort > /tmp/hashes_dir1
- find /tmp/dir\ 2/ -type f -exec md5sum "{}" \; |cut -d\ -f1 |sort > /tmp/hashes_dir2
- diff /tmp/hashes_dir1 /tmp/hashes_dir2
- # no output
- # trying the suggestion:
- diff -q /tmp/dir1 /tmp/dir\ 2
- # Somente em /tmp/dir 2: a long name for a subdir
- # Somente em /tmp/dir1: a subdir
- # Somente em /tmp/dir 2: cool
- # Somente em /tmp/dir1: foo
- # Somente em /tmp/dir1: so long file name with spaces
- # Showing the correspondent files:
- find /tmp/dir1 -type f -exec md5sum "{}" \; > /tmp/hashes_dir
- find /tmp/dir\ 2 -type f -exec md5sum "{}" \; >> /tmp/hashes_dir
- cat /tmp/hashes_dir |sort
- # c157a79031e1c40f85931829bc5fc552 /tmp/dir1/a subdir/bar
- # c157a79031e1c40f85931829bc5fc552 /tmp/dir 2/cool
- # d7f986677d9f563bd1794b09d82206a3 /tmp/dir1/foo
- # d7f986677d9f563bd1794b09d82206a3 /tmp/dir 2/a long name for a subdir/The Bar
- # eb4585ad9fe0426781ed7c49252f8225 /tmp/dir1/so long file name with spaces
- # eb4585ad9fe0426781ed7c49252f8225 /tmp/dir 2/a long name for a subdir/The Foo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement