cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in learning how media industry leaders use Dropbox Replay? Register for our webinar 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: 

dbx.files_move Error

dbx.files_move Error

Mgymnasts
Explorer | Level 4

I am getting Error listing folder contents: ApiError('NUMBERSANDLETTERS', ListFolderError('path', LookupError('not_folder', None)))

This comes from this line of code: 

dbx.files_move(source_path, destination_path)

I believe I am getting this error because of the to_path. Is that how I should read this error statement?

 

My file structure on dropbox is Parent Folder/Apps/Child Folder/Processed

 

The from_path is '/Child Folder/Grandchild Folder/filename.csv'

I have tried the to_path = '/Child Folder/Processed', to_path ='/Child Folder/Processed', to_path = "/Child Folder/Processed/filename.csv', to_path = "/Child Folder/Processed/filename.csv/" and all have given the same error.  I appreciate any help!

4 Replies 4

Здравко
Legendary | Level 20

Hi @Mgymnasts,

As seems, you're trying to list some file. 🙂 Only folders can be listed! When you perform list to the folder where particular file resides in, you will get that file information together with all other. Of course, you can get the file metadata directly if that's what you want, using corresponding method. By the way, this has nothing to do with the move.

Greg-DB
Dropbox Staff

@Mgymnasts Здравко is correct; while you mentioned using the 'files_move' method, the error output you showed contains a 'ListFolderError'. A ListFolderError would come from files_list_folder (or files_list_folder_get_latest_cursor). For comparison, files_move would raise a RelocationError. You can see the return and error types for each in the documentation linked there for each method.

 

So, that error is not coming from that particular line of code. In any case, the error itself means that the list_folder call failed because you supplied a path to something that isn't a folder; only folders can be listed like that. (If you want to get the metadata for a specific file, you would use files_get_metadata instead.)

 

By the way, you should use the newer files_move_v2 instead of files_move.

Mgymnasts
Explorer | Level 4

Looking to clarify: If I want to move a file from one folder to another, I should use files_move_v2 (from, to) where the from is the folder where the file is but this path doesn't include the file, and then the to folder is only the folder. Where do I clarify which file I am moving?  Or would this move all files in that folder? 

Greg-DB
Dropbox Staff

@Mgymnasts When using files_move_v2, the 'from_path' should be the full path of the item you want to move.

 

If you want to move an entire folder and its contents, you would specify the 'from_path' like '/Child Folder/Grandchild Folder', which would move just 'Grandchild Folder' and its contents, or '/Child Folder', which would move 'Child Folder' and its contents, which would also include 'Grandchild Folder' in this example.

 

If you want to move a specific file only, you would specify the 'from_path' like '/Child Folder/Grandchild Folder/filename.csv'.

 

Likewise, the 'to_path' should be the full path of where you want to put the item, either a folder path or a file path accordingly. For example, to move a specific file only that would be like '/Child Folder/Processed/filename.csv'.

Need more support?
Who's talking

Top contributors to this post

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