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: 

Event log and delete folder.

Event log and delete folder.

tritnguyen
Explorer | Level 3
Go to solution

Hi All,

I want to write a tool that keep track all the team members and their files on Dropbox. The information needs to be updated in 5 minutes interval. If a member adds a file, delete a file or rename the file, my tool will add/delete/update that file on the file list. Currently if the member adds a folder, my file list is updated correctly because Dropbox Java SDK sent out one event for each file in the folder. For example, it the folder has 3 files: f1.txt, f2.txt, and f3.txt, there will be 3 events to be sent. However, if the member delete a folder, there only one event to be sent; that event is for the folder, not for an individual file as the json below:

 

{
"timestamp" : "2022-11-04T04:10:55Z",
"event_category" : "file_operations",
"event_type" : {
".tag" : "file_delete",
"description" : "Deleted files and/or folders"
},
"details" : {
".tag" : "file_delete_details"
},
"actor" : {
".tag" : "admin",
"admin" : {
".tag" : "team_member",
"account_id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"display_name" : "Test Admin",
"email" : "testAdmin@test.com",
"team_member_id" : "test_admin_team_member_id"
}
},
"origin" : {
"access_method" : {
".tag" : "end_user",
"end_user" : {
".tag" : "web",
"session_id" : "session_id"
}
},
"geo_location" : {
"ip_address" : "",
"city" : "",
"region" : "",
"country" : ""
}
},
"involve_non_team_member" : false,
"context" : {
".tag" : "team_member",
".tag" : "team_member",
"account_id" : "account_id",
"display_name" : "Test Admin",
"email" : "testAdmin@test.com",
"team_member_id" : "test_admin_team_member_id"
},
"participants" : [ ],
"assets" : [ {
".tag" : "folder",
"path" : {
"namespace_relative" : {
"ns_id" : "xxxxxxxxxxxxx",
"relative_path" : "/TestFolder/SubTestFolder",
"is_shared_namespace" : false
},
"contextual" : "/TestFolder/SubTestFolder"
},
"display_name" : "SubTestFolder",
"file_id" : "sub_test_folder_file_id",
"file_size" : 44,
"file_count" : 4
} ]
}

 

I want to update my file list correctly; I want to remove f1.txt, f2.txt, and f3.txt from my list after I got the event above; what do I need to do?

Thank you.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

@tritnguyen To confirm what Здравко is saying, on Dropbox the deletion of a parent includes the deletion of any children of that parent, so it may be helpful to construct your data model/storage to reflect that as well.

 

See also, the /2/files/list_folder[/continue] for listing the contents of a folder, which also works that way.

View solution in original post

5 Replies 5

Здравко
Legendary | Level 20
Go to solution

@tritnguyen wrote:

...

I want to update my file list correctly; I want to remove f1.txt, f2.txt, and f3.txt from my list after I got ...


Hi @tritnguyen,

What about if you re-organize you "file list" in a file/folder tree? 🤔 You can always get a list out from the tree (if needed) and are able handle all event recursively whenever needed (like in situation mentioned by you). 😉

Hope this helps.

tritnguyen
Explorer | Level 3
Go to solution

The number of members in the company my tool is designed for may be huge. Develop the system to keep track all the folders and files for each member is time consuming, and I try to avoid that. Is there any quick and easy way to do the bookkeeping?

 

Thanks. 

Здравко
Legendary | Level 20
Go to solution

@tritnguyen wrote:

... Develop the system to keep track all the folders and files for each member is time consuming, and I try to avoid that. ...


I don't know such a bookkeeping way, but tree data structure processing typically consumes significantly less time that equivalent list processing (logarithmic vs linear load), if structured properly. That's why much more suitable for big data set (bigger difference between logarithm and line). 🤷

tritnguyen
Explorer | Level 3
Go to solution

I understand your suggestion; however, under the time I have to finish the task, I think I cannot use it. But thank you anyway.

Greg-DB
Dropbox Staff
Go to solution

@tritnguyen To confirm what Здравко is saying, on Dropbox the deletion of a parent includes the deletion of any children of that parent, so it may be helpful to construct your data model/storage to reflect that as well.

 

See also, the /2/files/list_folder[/continue] for listing the contents of a folder, which also works that way.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    tritnguyen Explorer | Level 3
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?