Rsync not updating timestamp

11-Jul-2017 02:28

The touch command will update the timestamp of /tmp/last Sync to reflect the fact that the script has just been run so that subsequent runs of the script use the current time as it's time base.The output of the find command can then be used to specify the files to copy to the destination using whatever method you like (cp, scp, whatever).Matt already addressed that question in his answer and clearly the answer is "no".Rsync is a tool that cares about contents, even if it's willing to just assume same contents when the dates match.The following little script will find files that have changed since the last time it was run: -cnewer file File's status was last changed more recently than file was modified.

(If an existing destination file has a modifi‐ cation time equal to the source file’s, it will be updated if the sizes are different.) Note that this does not affect the copying of symlinks or other special files.

I'm running Vagrant on OSX Lion with the base lucid32 box.

When I try to run guard within the VM, it works fine if I touch the files from within the VM.

The whole point of rsync is to make one file tree match another. If you want to copy the files in the way you want you will have to adopt a different method using different tools.

If a file in one tree has a different size to the same file in the other tree then they must, logically, differ. If you only want to copy files that have changed since a know date (say, the last time you copied the files) you can use find's -cnewer flag.

(If an existing destination file has a modifi‐ cation time equal to the source file’s, it will be updated if the sizes are different.) Note that this does not affect the copying of symlinks or other special files.I'm running Vagrant on OSX Lion with the base lucid32 box.When I try to run guard within the VM, it works fine if I touch the files from within the VM. The whole point of rsync is to make one file tree match another. If you want to copy the files in the way you want you will have to adopt a different method using different tools.If a file in one tree has a different size to the same file in the other tree then they must, logically, differ. If you only want to copy files that have changed since a know date (say, the last time you copied the files) you can use find's -cnewer flag.(risky for code, but with files with large GB like yours should be ok)... -maxdepth 1 -type f | while read filename; do if [ "$filename" ! = "output.sh" ]; then echo "Syncing $filename" mod Time=$(ls -la --full-time $filename | cut -d " " -f 6-7 | cut -b 1-19) echo "touch -d \"$mod Time\" $filename" Thanks a lot!