从批处理文件确定OneDrive同步状态 [英] Determine OneDrive Sync Status From Batch File

查看:85
本文介绍了从批处理文件确定OneDrive同步状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个OneDrive帐户和一个Dropbox帐户.我使用批处理文件复制文件夹&文件到适当的位置.

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

在批处理文件的开头,我使用SYSINTERNALS PSSUSPEND命令挂起Dropbox.然后,当OneDrive完全同步后,我可以使用SYSINTERNALS恢复Dropbox.

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.

我目前在恢复之前使用延迟策略,但是如果我确切地知道OneDrive的完成时间会更好.

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

我可以撤消同步,但是我也不知道如何确定Dropbox的同步状态.

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

推荐答案

最新答案,但也许对某人有帮助.

Late answer, but maybe it helps someone.

我刚刚发现一个愚蠢的简单解决方案:检出

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

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

(对于Windows,在其他操作系统中为类似的用户文件夹)

(for Windows, similar user folders in other OSes)

有一个 SyncDiagnostics.log 文件.

当OneDrive同步,检查在线文件的状态和映射以及完成同步时,它会更新.(不过,有一点需要注意:当唯一要同步的文件被文件句柄阻止时,OneDrive不会更新日志.)

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:

根据我的经验,它显示 0 完成和 255 同步.

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

您还可以使用其他有趣的变量,例如 FilesToDownload FilesToUpload 等.

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

这篇关于从批处理文件确定OneDrive同步状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆