Using Dropbox web interface to delete a folder with 30,000 files

I have a folder in my Dropbox with 30,000 files that I cannot delete using the web interface. It looks like I need to upload all 30,000 files to tell Dropbox, I really don't want them.

This error occurred because the machine that originally had the files disappeared, and I used selective synchronization to not download 30,000 files to all my other computers.

Can anyone think of a smart way around this? Just browsing a folder usually crashes the web interface.

+7
source share
2 answers

The only way to delete 30,000 files in a folder is to download them using selective synchronization. The web interface will give the error "Too many files, please use the desktop application." It is automated, so the only thing required is time (and enough space on the hard drive). If you do not have enough space, connect an external drive and drag the Dropbox folder there, download and delete.

This is a stupid problem, I know. I want you to be able to manage more through the web interface, as this is the central place for your files.

+8
source

I know this is a little (but not much), but for someone else who stumbles on this issue and has the same problem ... My problem is that I have hundreds of concerts of junk files only on Dropbox, and I I don’t want to clean the hard drive to remove them using selective synchronization.

Removing many files is still not possible from the web interface, but if you don't mind diving into the Dropbox API , it can be at least automated and you don't have to use your own storage (I did this below with the Python SDK , but there is and other language settings). The file limit is still applied, but the number of files in each directory can be counted to determine the correct way to delete them without starting the problem. For example:

The following script uses your unique Dropbox API key and the Dropbox directory listing ( deleteDirList ) as input. He then deleteDirList over each subdirectory of each deleteDirList element to determine if there are enough files to delete the directory without restriction (I set a limit on conservative (?) 10,000 files); if there are too many files, it deletes the files individually until the counter goes below the limit. You will need to install the Python dropbox package (I use Anaconda, so conda install dropbox )

Remember, this is a brute force approach; Each subdirectory is deleted one after another, which can take a long time. The best method would be to count the files in each subdirectory, then determine the highest level directory that can be deleted without restriction, but, unfortunately, I do not have time to implement this 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)) 
+1
source

All Articles