Valutazione attuale: 5 / 5

Stella attivaStella attivaStella attivaStella attivaStella attiva
 

Let me start saying "Finally Fixed!"...Ok, it's just a work around but you can be sure to find all differences. 

Who use the "directory comparison" feature noted for sure green folders but files are the same. This just because foler modified timestamp in folders are different.

Well today I fixed it using 2 tools, one for Windows side and one for Linux:

- Nirsoft FolderTimeUpdate

- Bash Script found on Stack Exchange

 

Folder Time Update

FolderTimeUpdate is a simple tool for Windows that scans all files and folders under the base folder you choose, and updates the 'Modified Time' of every folder according the latest modified time of the files stored in it.

folder time update

  

Bash Script folderTimeUpdate 

#! /bin/bash

# Change mtime of directories to that of latest file (or dir) under it, recursively
# Empty leaf directories, or dirs with only symlinks get the $default_timestamp
# https://unix.stackexchange.com/a/352334/497183

default_timestamp='1980-01-01 00:00:00'

dir="$1"

[ -d "$dir" ] || { echo "Usage: $0 directory" >&2; exit 1; }

find "$dir" -depth -type d | while read d; do
    latest=$(find "$d" -mindepth 1 -maxdepth 1 \( -type f -o -type d \) -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-)
    if [ -n "$latest" ]; then
        touch -c -m -r "$latest" "$d" \
            || echo "ERROR setting mtime of '$d' using ref='$f'" >&2
    else
        touch -c -m -d "$default_timestamp" "$d" \
            || echo "ERROR setting mtime of '$d' to default '$default_timestamp'" >&2
    fi
done

 

Limitation

  • You need a Linux Bash Shell to run folderTimeUpdate script.
  • You need to run often both to be sure find all differences

 

 

- have fun -

 

DISQUS - Leave your comments here