cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i use Sync API to check if a file is deleted by other computer?

How can i use Sync API to check if a file is deleted by other computer?

C. Tim
New member | Level 2

We are evaluating Sync API for our file sync function in a new app.
Our app stores user data in local file system and allow them to sync the local file system with a folder in users' dropbox account.
Here comes a question:
When we compare all local files with their remote correspondences. If there is a file exists in local, but not in dropbox,
How can we know if it's deleted from dropbox by other dropbox clients or it's simple a new file from local?

11 Replies 11

Greg-DB
Dropbox Staff

Do you mean you're trying to manually keep a local filesystem in sync with the Dropbox account? The Sync SDK wasn't really designed for that use case. Instead, it's intended that you'd use the Sync SDK as the source of truth for the files, where you let it maintain consistency with the server itself, cache files, etc. The Sync SDK just tells you when something changes, and not what exactly, with the intention that you'd just reload any necessary state from the SDK itself when building your UI.

If you need to know exactly what has changed, in order to manually sync with your own local filesystem, you may want to use a Core SDK with /delta functionality instead:

https://www.dropbox.com/developers/core
https://www.dropbox.com/developers/core/docs#delta

C. Tim
New member | Level 2

Thank you for the answer!
We do intend to manually keep a local filesystem in sync with Dropbox account.
Is it possible that we can use Sync SDK for listing all file entries recursively and use Core SDK for more detail info at the same time?
We heard that these two SDKs seemed can not be used together?
The other question: does /delta return deleted file entries since previous cursor?

Greg-DB
Dropbox Staff

You could technically use both the Sync and Core SDKs together in the same app, but we don't recommend doing so. They weren't built with that in mind, so it's relatively difficult to do, and we don't have any specific instructions for making it work.

Yes, /delta notifies you of deleted files.

C. Tim
New member | Level 2

Is it possible to use Core API's "/delta" command to get the file delete time (like the last modified date) so we can know whether there is a file conflict between our local file and the dropbox file?

Greg-DB
Dropbox Staff

The /delta returns null for deleted items, just to tell your app that there is now nothing at that path, and not metadata, so that wouldn't work directly. You could then use /metadata or /revisions to see what you need though.

Greg-DB
Dropbox Staff

You can think of the 'rev' of a file as an address in the history of the account, and not as a unique identifier of the contents of the file.

  1. If you mean "unique file snapshot ID" in reference to the file content, no, other files, or the same file, with different revs may contain the same data. Or, if you are asking if a particular rev is unique to a file, yes, no other file will ever have that same rev.

  2. Yes, moving a file will change its rev.

C. Tim
New member | Level 2

If a file is deleted, will its rev be recycled to used in the other file change?
i.e. a file, xyz, whose rev was "1234", was deleted, and at the same time, the other file, abc, whose rev was "5678", was moved to somewhere, and got a new rev, "1234", which was recycled from the deleted file, xyz. Is it possible?
The reason to ask this question is to know whether can we use rev to detect any file rename or move action taken place in dropbox side by ourself.

Greg-DB
Dropbox Staff

No, revs are not recycled or re-used. There currently isn't a good method for tracking moved/renamed files via the API.

C. Tim
New member | Level 2

We can generate file fingerprint for every local file (before uploading to dropbox) and store them in our app.
Whenever there are delta notifying added files and deleted files, we can download the new file data from dropbox and retrieve the deleted file data from our local file by looking up the fingerprint database in our app.
Then, compare their fingerprints to know whether is there any rename or move change in dropbox side.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    C. Tim New member | Level 2
  • User avatar
    Brendan D. Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?