cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Find out how Tiffany, a Customer Experience superstar uses Dropbox to keep her family in the loop when it comes to her new baby here!

Dropbox files & folders

Get in sync with the Dropbox Community. Our members can answer all your questions on Dropbox files and folders. Join a discussion or start your own today.

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

can I open thousands of files in python without causing Dropbox to sync each one?

can I open thousands of files in python without causing Dropbox to sync each one?

Tunneller
New member | Level 2

Hi, I need to iterate through a few tens of thousands of files on Dropbox using python, more specifically, doing something like this:

 

mynewdata = []

for subdir, dirs, files in os.walk(dropbox_folder):
    for file in files:

        with open(os.join(subdir.file)) as csvfile:

            df = pd.read_csv(csfile)

            mynewdata.append(df.iloc[0,0])

 

My intent is to not change any file, just open it, load into pandas, extra a tiny bit of information, close and move onto the next file. All of the files are already synced on both cloud and laptop. But "someone" is touching the file during the python loop, and causing Dropbox to sync, which slows everything down. If I open the file in read_only will that solve the problem, or am I doomed?

 

Thanks, T.

 

 

 

2 Replies 2

Re: can I open thousands of files in python without causing Dropbox to sync each one?

Mark
Super User II

You are doomed here I'm afraid - the flag of the file will change (i.e. last opened etc.) and so they'll resync. 

 

What you could do is pause syncing while you do it and then restart after as the sync itself should be quite quick.


 


:penguin::penguin: - :penguin: - :penguin: - :penguin:


Heart Did this post help you? If so please mark it for some Kudos below. 


:white_check_mark: Did this post fix your issue/answer your question? If so please press the 'Accept as Solution' button to help others find it.


:arrows_counterclockwise: Did this post not resolve your issue? If so please give us some more information so we can try and help - please remember we cannot see over your shoulder so be as descriptive as possible! 


 

Re: can I open thousands of files in python without causing Dropbox to sync each one?

Tunneller
New member | Level 2

Clever. I will try that 🙂

Who's talking

Top contributors to this post

  • User avatar
    Tunneller New member | Level 2
  • User avatar
    Mark Super User II
What do Dropbox user levels mean?
Need more support?