How to know if rclone sync is finished?

I have a small windows application which has rclone placed inside. This app allows users to collect assets (graphic files) in their computer, then hit "upload" button to upload their files to AWS S3.

By the time an user hits the upload button, this app collects everything and stores to a temporary folder, and uploads this folder to S3. And this temporary folder need to be clean up after uploading done.

Could somebody please advise how to know if rclone sync is finished, and base on that "event" this windows app knows when to clean up the temporary folder.

Thanks so much!

rclone sync should stop and the rclone binary should exit when it is finished. So if you run the binary synchronously you can see when it has stopped and read its exit code which will tell you whether it was successful or not.

Thanks for your reply. But when the background process calls to rclone, it runs in new windows, that's why I couldn't know the time it finishes.

which app?
how to do you launch rclone?

using batch code as an example

set tempfolder=c:\path\to\temp\folder
rclone sync c:\path\to\local\folder dest:
rmdir %tempfolder%

This is how I launch rclone (via a windows batch script):

@echo off

cd /d C:\\temp\\rclone
rclone sync C:\temp\collection_3427996 s3:/user_collection_tester01 --delete-after

if not %ERRORLEVEL% equ -1 (
   start C:\temp\collection_cleanup_3427996.cmd


This script will open up a new cmd window for rclone to run and doesn't wait for it and immediately execute "rmdir %tempfolder%".

As a workaround, can you use "start /wait" to force it to wait for rclone to complete, even though it is started in a separate window?

start /wait "" rclone sync ...


There's a malware or virus affected my computer that caused the issue. Finally I decided to re-install my Windows and it works like a charm.

Thank you guys and I am sorry for wasting your time.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.