Determine OneDrive Sync Status From Batch File

旧时模样 提交于 2021-01-28 00:35:38

问题


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.


回答1:


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.




回答2:


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
...


来源:https://stackoverflow.com/questions/42167353/determine-onedrive-sync-status-from-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!