7

I have a folder in my dropbox with 30,000 files, that I can't delete using the web interface. It appears that I have to download all 30,000 files in order to tell dropbox I really don't want them.

This error arose because the machine that originally had the files is gone, and I was using selective sync to avoid downloading 30,000 files to all of my other computers.

Can anyone think of a clever way to work around this? Just viewing the folder usually causes the web interface to crash.

Zach
  • 29,791
  • 35
  • 142
  • 201
  • What's the total size of the 30,000 files? – Flukey Nov 22 '11 at 22:48
  • @Flukey: maybe 500mb to 1GB. They're pretty small. – Zach Nov 23 '11 at 00:38
  • I solved this by sucking it up and waiting 12 hours for the files to all download to another machine. Then I deleted them, and things are peachy now. – Zach Nov 23 '11 at 15:09
  • Also, it was 500mb to 1GB for the biggest files. I think the total directory size was about 30 or 40 GB. – Zach Mar 25 '13 at 17:58

2 Answers2

8

The only way to delete 30,000+ files in a folder is to download them using selective sync. The web interface will give the "Too many files please use the desktop application" error. It is automated, so the only thing it takes is time (and enough hard drive space). If you don't have enough space, plug in an external drive and repoint the Dropbox directory there, let it download, then delete.

This is a stupid issue, I know. I wish you could manage more via the web interface since this IS the central location for your files.

Jason Clemens
  • 98
  • 1
  • 4
  • 1
    Couldn't believe it's 2015 !! Still great products lack less obvious yet basic features. – nehem Mar 09 '15 at 05:11
  • @itsneo It's 2015 and 'features' still need to be programmed one by one into every application we write. Somewhere some major step in the evolution of programming is missing. Just my two cents. – masterxilo Sep 26 '15 at 21:58
  • Sad though, As Jason pointed "Web interface is the central location for all files" for which Dropbox should put more money and talent. But I know when DB started the opinion was different but chanced over the time and growth of this popular product. – nehem Sep 27 '15 at 01:42
  • Hello from 2018. Can't move folder with more than 10k files inside recursively. – Vlad Aug 02 '18 at 07:53
2

I know this is (a bit) late, but for anyone else who stumbles across this question and has the same issue... My problem specifically is that I have hundreds of gigs of no-longer-needed files only on the Dropbox servers and I don't want to clean off a HDD just to be able to delete them with selective sync.

Deleting that many files still isn't possible from the web interface, but if you don't mind diving into the Dropbox API this can at least be automated and you won't have to use your own storage (I did this below with the Python SDK, but there are other language options). The file limit still applies, but the number of files in each directory can be counted to determine the proper way to delete them without running into the issue. Like so:

The following script takes your unique Dropbox API key and a list of Dropbox directories (deleteDirList) as inputs. It then loops through each subdirectory of each element of deleteDirList to determine if there are few enough files to be able to delete the directory without hitting the limit (I set the limit to a conservative(?) 10,000 files); if there are too many files, it deletes files individually until the count is below the limit. You'll need to install the Python package dropbox (I use Anaconda, so conda install dropbox)

Bear in mind this is a brute-force approach; each subdirectory is deleted one-by-one which could take a long time. A better method would be to count the files in each subdirectory then determine the highest-level directory that can be deleted without hitting the limit, but unfortunately I don't have time to implement that at the moment.

import dropbox




##### USER INPUT #####

appToken = r'DROPBOX APIv2 TOKEN'
deleteDirList = ['/directoryToDelete1/','/directoryToDelete2/']      # list of Dropbox paths in UNIX format (where Dropbox root is specified as '/') within which all contents will be deleted. The script will go through these one at a time. These need to be separate directories; subdirectories will deleted in the loop and will throw an exception if listed here.

######################




dbx = dropbox.Dropbox(appToken)
modifyLimit = 10000

# Loop through each path in deleteDirList
for deleteStartDir in deleteDirList:
    deleteStartDir = deleteStartDir.lower()

    # Initialize pathList. This is the variable that records all directories down each path tree so that each directory is traversed, files counted, then deleted
    pathList = [deleteStartDir]

    # Deletion loop
    try:
        while 1:

            # Determine if there is a subdirectory in the current directory. If not, set nextDir=False
            nextDir = next((x.path_lower for x in dbx.files_list_folder(pathList[-1]).entries if isinstance(x,dropbox.files.FolderMetadata)),False)

            if not not nextDir:     # if nextDir has a value, append the subdirectory to pathList
                pathList.append(nextDir)
            else:       # otherwise, delete the current directory
                if len(pathList)<=1:        # if this is the root deletion directory (specified in deleteDirList), delete all files and keep folder
                    fileList = [x.path_lower for x in dbx.files_list_folder(pathList[-1]).entries]
                    print('Cannot delete start directory; removing final',len(fileList),'file(s)')
                    for filepath in fileList:
                        dbx.files_delete(filepath)

                    raise EOFError()    # deletion script is complete

                # Count the number of files. If fileCnt>=modifyLimit, remove files until fileCnt<modifyLimit, then delete the remainder of the directory
                fileCnt = len(dbx.files_list_folder(pathList[-1]).entries)
                if fileCnt<modifyLimit:
                    print('Deleting "{path}" and'.format(path=pathList[-1]),fileCnt,'file(s) within\n')
                else:
                    print('Too many files to delete directory. Deleting',fileCnt-(modifyLimit+1),'file(s) to reduce count, then removing',pathList[-1],'\n')
                    fileList = [x.path_lower for x in dbx.files_list_folder(pathList[-1]).entries]
                    for filepath in fileList[-modifyLimit:]:
                        dbx.files_delete(filepath)

                dbx.files_delete(pathList[-1])
                del pathList[-1]

    except EOFError:
        print('Deleted all relevant files and directories from "{}"'.format(deleteStartDir))
jshrimp29
  • 588
  • 6
  • 8