aboutsummaryrefslogtreecommitdiff
path: root/ssync-queue
diff options
context:
space:
mode:
Diffstat (limited to 'ssync-queue')
-rwxr-xr-xssync-queue9
1 files changed, 6 insertions, 3 deletions
diff --git a/ssync-queue b/ssync-queue
index 021c1c3..2063420 100755
--- a/ssync-queue
+++ b/ssync-queue
@@ -83,7 +83,7 @@ remote_index_filenames_file=$queue_tmp_dir/remote_filenames.idx
verbose_log "Writing remote index filenames to $remote_index_filenames_file"
cat $REMOTE_FILE_ARG | xargs -I{} basename {} > $remote_index_filenames_file
original_line_count=$(lines $REMOTE_FILE_ARG)
-unique_line_count=$(lines <(sort -u $remote_index_filenames_file))
+unique_line_count=$(sort -u $remote_index_filenames_file | lines)
verbose_log "Remote index contains $unique_line_count unique filenames out of $original_line_count indexed files"
if [ $original_line_count != $unique_line_count ]; then
@@ -91,9 +91,12 @@ if [ $original_line_count != $unique_line_count ]; then
fi
# find which filenames are unique to the remote
+local_sorted=$queue_tmp_dir/local_sorted.idx
+remote_sorted=$queue_tmp_dir/remote_sorted.idx
remote_only_filenames_file=$queue_tmp_dir/remote_only_filenames.idx
-comm -23 <(sort $remote_index_filenames_file) <(sort $LOCAL_FILE_ARG) \
- > $remote_only_filenames_file
+sort $LOCAL_FILE_ARG > $local_sorted
+sort $remote_index_filenames_file > $remote_sorted
+comm -23 $remote_sorted $local_sorted > $remote_only_filenames_file
verbose_log "Found $(lines $remote_only_filenames_file) remote only files"
# push matching files into queue