Remove 'deleting' prefix from rsync rename status output

The rsync rename operation uses --delete flag which outputs 'deleting filename/'
in the status. This could cause user confusion as it looks like files are being
deleted rather than moved. Filter out the 'deleting ' prefix with sed before
writing to status file to show a cleaner 'Moving... filename/' message.
This commit is contained in:
mgutt
2025-10-29 22:46:11 +01:00
parent e2f53a664d
commit f0d0c288df
+2 -1
View File
@@ -454,9 +454,10 @@ while (true) {
// notes:
// - existing files are overwritten in --backup-dir (like not using --ignore-existing)
// - missing directories are created in --backup-dir (like using --mkpath)
// - rsync prefixes the moved files with "deleting " in the output, which we strip with sed, to not confuse the user
if ($use_rsync_rename) {
$parent_dir = dirname(validname($source[0]));
$cmd = "rsync -r --out-format=%f --info=flist0,misc0,stats0,name1,progress2 --delete --backup --backup-dir=".escapeshellarg($target)." ".quoted_rsync_include($source)." --exclude='*' ".escapeshellarg($empty_dir)." ".escapeshellarg($parent_dir)." > >(stdbuf -o0 tr '\\r' '\\n' >$status) 2>$error & echo \$!";
$cmd = "rsync -r --out-format=%f --info=flist0,misc0,stats0,name1,progress2 --delete --backup --backup-dir=".escapeshellarg($target)." ".quoted_rsync_include($source)." --exclude='*' ".escapeshellarg($empty_dir)." ".escapeshellarg($parent_dir)." > >(stdbuf -o0 tr '\\r' '\\n' | sed 's/^deleting //' >$status) 2>$error & echo \$!";
exec($cmd, $pid);
// use rsync copy-delete