问题
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