2011-11-22 2 views
7

웹 컨테이너를 사용하여 삭제할 수없는 30,000 개의 파일이있는 보관함이 있습니다. dropbox에 정말로 30,000 개의 파일을 모두 다운로드해야한다는 것을 알았습니다.드롭 박스 웹 인터페이스를 사용하여 30,000 개의 파일이있는 폴더 삭제

이 오류는 파일을 원래 가지고 있던 컴퓨터가 없어지고 선택 동기화를 사용하여 다른 모든 컴퓨터에 30,000 개의 파일을 다운로드하지 않기 때문에 발생했습니다.

누구든지이 문제를 해결할 수있는 영리한 방법을 생각할 수 있습니까? 일반적으로 폴더를 보는 것만으로 웹 인터페이스가 중단됩니다.

+0

30,000 개의 파일의 총 크기는 얼마입니까? – Flukey

+0

@Flukey : 1GB 당 500MB. 그들은 꽤 작습니다. – Zach

+0

나는 그것을 빨아 들이고 12 시간 동안 파일이 다른 컴퓨터에 다운로드 될 때까지 기다리는 것으로 해결했다. 그럼 내가 그들을 지웠고, 지금은 복숭아 같다. – Zach

답변

8

폴더에서 30,000 개 이상의 파일을 삭제할 수있는 유일한 방법은 선택 동기화를 사용하여 파일을 다운로드하는 것입니다. 웹 인터페이스는 "너무 많은 파일이 데스크톱 응용 프로그램을 사용하십시오."오류를 표시합니다. 자동으로 수행되기 때문에 시간은 충분합니다 (충분한 하드 드라이브 공간). 공간이 충분하지 않은 경우 외부 드라이브를 연결하고 Dropbox 디렉토리를 다시 지정하고 다운로드 한 다음 삭제하십시오.

이것은 바보 같은 문제입니다. 이 파일은 웹 인터페이스를 통해 더 많은 것을 관리 할 수 ​​있기를 바랍니다.

+1

2015 년이라고 믿을 수 없었다 !! 여전히 훌륭한 제품은 아직 명확하지 않지만 기본 기능이 부족합니다. – nehemiah

+0

@itsneo 2015 년이고 '기능'은 여전히 ​​우리가 작성하는 모든 응용 프로그램에 하나씩 프로그래밍해야합니다. 어딘가에서 프로그래밍 진화의 주요 단계가 빠져 있습니다. 그냥 내 두 센트. – masterxilo

+0

Jason이 생각하기에 Jason은 "웹 인터페이스는 Dropbox가 더 많은 돈과 재능을 가져야하는 모든 파일의 중심 위치"라고 지적했습니다.그러나 DB가 시작했을 때의 의견은 달랐지만이 인기있는 제품의 시간과 성장에 따라 차이가있었습니다. – nehemiah

1

나는 이것이 (조금) 늦었다 고 알고 있지만,이 질문에 걸려 넘어지면서 같은 문제가있는 다른 사람을 위해 ... 내 문제는 특별히 내가 필요로하는 파일이 수백 개 밖에 없다는 것입니다. Dropbox 서버와 나는 선택적 동기화로 HDD를 삭제할 수 없도록 HDD를 정리하고 싶지 않습니다.

많은 파일을 여전히 삭제할 수는 없지만 Dropbox API으로 들어가기를 원한다면 적어도 자동으로 수행 할 수 있으므로 자신의 저장소를 사용할 필요가 없습니다. 아래는 Python SDK이지만 다른 언어 옵션도 있습니다). 파일 제한은 계속 적용되지만 각 디렉토리의 파일 수를 계산하여 문제를 해결하지 않고 파일을 삭제하는 적절한 방법을 결정할 수 있습니다. 마찬가지로 :

다음 스크립트는 고유 한 Dropbox API 키와 Dropbox 디렉토리 목록 (deleteDirList)을 입력으로 사용합니다. 그런 다음 각 요소의 각 하위 디렉토리 (deleteDirList)를 반복하여 제한을 두지 않고 디렉토리를 삭제할 수있는 파일이 부족한 지 확인합니다 (보수적 인 (?) 10,000 개의 파일로 제한 설정). 너무 많은 파일이있는 경우 파일 수가 한도 아래로 내려갈 때까지 파일을 개별적으로 삭제합니다. 당신은 파이썬 패키지 dropbox을 설치해야합니다 (저는 Anaconda를 사용합니다, 그래서 conda install dropbox)

이것은 무차별 대입 방식입니다. 각 서브 디렉토리는 하나씩 삭제되어 오랜 시간이 걸릴 수 있습니다. 더 나은 방법은 각 하위 디렉토리의 파일을 계산 한 다음 제한을 두지 않고 삭제할 수있는 최상위 디렉토리를 결정하는 것입니다. 그러나 불행히도 지금은 구현할 시간이 없습니다.

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))