Find the answer to your Linux question:
Results 1 to 4 of 4
If I do: diff -r /path/to/folder1 /path/to/folder2 Will it output all the files that are different as well? All I see is: Code: Only in /mnt/MEDIA/backup-101708/drv01/Documents/news: microsoftNSA Only in /mnt/MEDIA/backup-101708/drv01/Linux: ...
  1. #1
    Just Joined!
    Join Date
    Oct 2005
    Posts
    20

    comparing directories

    If I do:

    diff -r /path/to/folder1 /path/to/folder2

    Will it output all the files that are different as well? All I see is:

    Code:
    Only in /mnt/MEDIA/backup-101708/drv01/Documents/news: microsoftNSA
    Only in /mnt/MEDIA/backup-101708/drv01/Linux: amule
    Only in /mnt/MEDIA/backup-101708/drv01/Linux/kde: koffice
    Only in /mnt/MEDIA/backup-101708/drv01/Linux: mldonkey
    Only in /mnt/MEDIA/backup-101708/drv01/Linux/pkg: jailkit-2.5-k8-11208.tgz
    Only in /mnt/MEDIA/backup-101708/drv01/: My Music
    Only in /mnt/MEDIA/backup-101708/drv01/: My Pictures
    Only in /mnt/tmp/: O&O
    Only in /mnt/MEDIA/backup-101708/drv01/: olddrv
    Now, I realize that jailkit-etc-etc is a file, but I know I have a folder with a bunch of pictures on one drive, but the folder is empty on the other. Now, it did spew a lot of:

    Code:
    diff: /mnt/MEDIA/backup-101708/drv01/Linux/games/BattleforWesnoth/wesnoth-1.4.2/conf21952: No such file or directory
    diff: /mnt/tmp/Linux/games/BattleforWesnoth/wesnoth-1.4.2/conf21952: No such file or directory
    diff: /mnt/MEDIA/backup-101708/drv01/Linux/games/BattleforWesnoth/wesnoth-1.4.2/conf21952.dir/conf21952.file: Too many levels of symbolic links
    diff: /mnt/tmp/Linux/games/BattleforWesnoth/wesnoth-1.4.2/conf21952.dir/conf21952.file: Too many levels of symbolic links
    diff: /mnt/MEDIA/backup-101708/drv01/Linux/games/BattleforWesnoth/wesnoth-1.4.2/conftest.sym: No such file or directory
    diff: /mnt/tmp/Linux/games/BattleforWesnoth/wesnoth-1.4.2/conftest.sym: No such file or directory
    diff: /mnt/MEDIA/backup-101708/drv01/Linux/net/ocaml-3.10.2/_build/boot/libcamlrun.a: No such file or directory
    But there's so much of that and that's all stderr anyway.... at least I think because > doesn't redirect it to a file. Of course, neither does 2>???

    So, how do I compare two directories AND the contained file?


    In case I'm confusing things. I have two drives. One is a cp -R of the other. I want to know what files are in the original drive that aren't in the copy. I have used both drives since I cp -R, and I want to keep those files.

  2. #2
    Linux Newbie
    Join Date
    Apr 2007
    Posts
    211
    I don't really know much about it, and for some reason seems that you know what you're doing to an extent that you'd not like my suggestion, but I'll suggest anyway. Perhaps you may want to try komparator, a GUI for comparing two folders, quite easy to do, my only critique is that it has an weird redundance on having to assign the reference folder as "left" or "right", which looks like some sort of vestigial feature with no use.

    But other than that, you can compare the two folders, and set many sorts of parameters other than just filenames, and even right click the files to open them or whatever. Can also choose to move the files, or move to trash, and so on.

    But some people prefer (or may need to) do things on command line, and if that's the case, I cannot be of any help.

  3. #3
    Just Joined!
    Join Date
    Oct 2005
    Posts
    20
    Ok, great. Thanks. That'll get the job done. That's all I'm really concerned with.

  4. #4
    Linux Newbie
    Join Date
    Sep 2007
    Posts
    161
    hi hedron!

    the diff command takes a "-r" flag to turn on recursive mode.
    in combination -q and -s this may be just what you need.

    personally, like dsc, i use a GUI tool for these purposes. my choice is xxdiff.

    cheers, kai

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...