Old Man OBIE
Old Man OBIE

Reputation: 63

Determine OneDrive Sync Status From Batch File

I have a OneDrive account and a Dropbox account. I use a batch file to copy my folders & files to the appropriate places.

At the beginning of the batch file I use SYSINTERNALS PSSUSPEND command to suspend Dropbox. Then when OneDrive is fully synced, I can resume Dropbox using SYSINTERNALS.

I currently use a delay tactic before resuming, but it would be better if I knew exactly when OneDrive was finished.

I could reverse the syncs, but I don't know how to determine the sync status for Dropbox either.

Upvotes: 3

Views: 6904

Answers (2)

M4kD3v
M4kD3v

Reputation: 9

download DBStatusc https://sites.google.com/site/macdsite/utilidades/dbstatusc-1 Get the DropBox status in Windows

echo WAIT DROPBOX_UP_TO_DATE...
:REPEAT
if exist status.tmp del status.tmp
timeout /t 10
D:\bin\dbstatusc c:\DropBox > status.tmp
findstr /m "Up to Date" status.tmp
if %errorlevel%==1 GOTO REPEAT
...

Upvotes: 0

Vankog
Vankog

Reputation: 697

Late answer, but maybe it helps someone.

One stupid simple solution I just found out myself: Check out

%LocalAppData%\Microsoft\OneDrive\logs\Personal\

(for Windows, similar user folders in other OSes)

There is a SyncDiagnostics.log file.

It gets updated when OneDrive is syncing, checking the status and mapping of online files and when it's done synchronizing. (One little caveat, though: OneDrive won't update the log, when the only file to sync is blocked by a file handle.)

For example, you could check for file modification and then check the variable

SyncProgressState:

In my experience it shows 0 for done and 255 for syncing.

There are also other interesting variables you can utilize, like FilesToDownload and FilesToUpload and so on.

Upvotes: 5

Related Questions