All pastes #24974 Raw Edit

sp3000

public shellscript v1 · immutable
#24974 ·published 2005-10-08 21:44 UTC
rendered paste body
for d in E D C; do    a_base="$d:\\"    e_base="/windows/$d"    for ((i=1;;++i)); do        [ "$(find "$a_base" -mindepth $i -maxdepth $i -print -quit)" ] || break        find "$a_base" -mindepth $i -maxdepth $i -printf "%P\n" \        | while read p; do            a_lead="${p%/*}"            expr "$p" : '.*/' >/dev/null || a_lead=""            [ -d "$e_base/$a_lead" ] || continue            a_name="${p##*/}"            e_path="$(find "$e_base/$a_lead" -maxdepth 1 -iname "$a_name")"            [ -f "$e_path" ] \            && nice cmp -s "$a_base/$p" "$e_path" \            && chmod -c +w "$a_base/${p%/*}" \            && rm -v "$a_base/$p" \            && continue            [ -d "$e_path" ] \            && e_name="${e_path##*/}" \            && [ "$a_name" != "$e_name" ] \            && chmod -c +w "$a_base/$a_lead" \            && mv -v "$a_base/$a_lead/$a_name" "$a_base/$a_lead/$e_name"         done    done    find "$a_base" -depth -type d -empty -exec rmdir -v "{}" \;done 2>&1 | tee -a KILL.log