Meanwhile  I wrote a script to compare two directories without subdirectories.
It should run at least with Debian Buster and Bash 4.4.

The script copies the files to temporary directories using symbolic links,
so you can change the original files later.

Example:
mymeld -d . subdir    # compare current directory with a subdirectory
mymeld  dir1 dir2     # without option "-d", original meld is used

Script mymeld:
#!/bin/bash
if [[ "$1" == "-d"  ]]; then
    shift

    # check args
    if (( "$#" != 2 )); then
        echo "Usage: $0 -d dir1 dir2"
        echo "Compare dir1 with dir2 (without subdirectories)"
        exit 1
    fi

    # make realpaths because of symbolic links
    dir1="$(realpath "$1")"
    dir2="$(realpath "$2")"

    if [[ ! -d "$dir1" ]]; then
        echo "ERROR: 1st directory does not exist: $dir1"
        exit 1
    fi
    if [[ ! -d "$dir2" ]]; then
        echo "ERROR: 2nd directory does not exist: $dir2"
        exit 1
    fi

    # make temporary directories
    tmp0="$(mktemp -d /tmp/wd-XXXXXX)"

    tmp1="$tmp0/1.$(basename "$dir1")" # 1 so tmp1 != tmp2
    tmp2="$tmp0/2.$(basename "$dir2")" # 2 so tmp1 != tmp2
    mkdir "$tmp1"
    mkdir "$tmp2"

    # copy to temporary directories with symbolic links
    find  "$dir1" -maxdepth 1 -type f -exec cp -s -- {} "$tmp1" \;
    find  "$dir2" -maxdepth 1 -type f -exec cp -s -- {} "$tmp2" \;

    # meld
    (
        meld  "$tmp1" "$tmp2"
        rm -r "$tmp0"
    ) &
else
    meld "$@" &
fi
#done

Best Regards
JB

_______________________________________________
meld-list mailing list
meld-list@gnome.org
https://mail.gnome.org/mailman/listinfo/meld-list

Reply via email to