Hello there.
After using rclone for synchronization between a local source system and a remote destination cloud storage, I've realized that log files storing changes of such commands which transfer data (sync, copy, copyto , move, moveto) are filled in random order by default (i.e. not alphabetically), because that's the nature of checking and transferring source files to destination in the first place within the rclone backend logic.
I guess the only option to run through the source files alphabetically (and then to sync those files to destination and to write those changes to logs alphabetically as well) is to use the --order-by=name parameter (only for sync, copy and move commands). But it does not guarantee a perfect ordering anyway, maybe even in combination with the --check-first parameter.
If you'd like to sort such transferring change log files afterwards, it should be done in two different ways:
- The one
combinedlog file should not be sorted regularly, but from the third character to the end of each line within, because the first character of each line there is a status icon (=-+*!), and the second character is the space between a status icon and a file path. - All of the other change log files (
matchdiffermissing-on-srcmissing-on-dsterror) should be sorted regularly, i.e. by each line within the file completely.
Here is the block of code that provides such an in-place sorting on a Linux machine:
sort -k1.3 "${log_file_mask}_combined.log" -o "${log_file_mask}_combined.log"
for suffix in match differ missing-on-src missing-on-dst error; do
log_file_name="${log_file_mask}_${suffix}.log"
if [ -f "$log_file_name" ]; then
sort "$log_file_name" -o "$log_file_name"
fi
done
So I’d like to know if that would make sense to add a separate parameter to these rclone transferring commands (sync, copy, copyto , move, moveto) that might be called, for example, --sort-transfer-logs, to properly sort such log files alphabetically at the end of transferring command’s execution.
Of course, it may not be approved as a proposed feature request, because somehow it goes beyond the rclone application main scope of tasks. In such a way I'd like to add such sorting considerations to the Logging section of Usage documentation page.