在Dropbox API中编辑文件名

时间:2021-06-16 23:12:56

How to edit file or folder name using dropbox api?

如何使用dropbox api编辑文件或文件夹名称?

I was using this reference: https://www.dropbox.com/developers/core/docs

我使用的是这个参考:https://www.dropbox.com/developers/core/docs

Is there anything else?
Is it even possible?

还有别的事吗?它甚至可能吗?

2 个解决方案

#1


9  

Your question title and body seem to ask slightly different questions, so I'll answer both:

你的问题标题和正文似乎问了一些略有不同的问题,所以我会回答两个问题:

You can edit a file (i.e., its contents) by uploading a new version of it, e.g., using the /files_put call:

您可以通过上传新版本的文件(例如,使用/ files_put调用)来编辑文件(即其内容):

https://www.dropbox.com/developers/core/docs#files_put

https://www.dropbox.com/developers/core/docs#files_put

You can rename a file or folder using the /filesops/move endpoint:

您可以使用/ filesops / move端点重命名文件或文件夹:

https://www.dropbox.com/developers/core/docs#fileops-move

https://www.dropbox.com/developers/core/docs#fileops-move

#2


0  

Don't worry about this, if you have a file and you want to rename it, then simply follow this logic it will solve your problem.

不要担心这一点,如果你有一个文件而你想重命名它,那么只需按照这个逻辑它就可以解决你的问题。

  1. Get Name of File and Change it and store the change name in string variable.
  2. 获取文件名并更改它并将更改名称存储在字符串变量中。
  3. Keep Parent Path of the original File.
  4. 保留原始文件的父路径。
  5. Move File to other place with the change Name get from String variable.
  6. 使用更改Name from String变量将文件移动到其他位置。
  7. Now move the File back from new place to old place,
  8. 现在将文件从新位置移回旧位置,
                 How to do it Programatically,
  Entry global_file;//assign any file to it 
  String FilePath=global_file.path;
  String parent_path=global_file.parentPath();//Keep parent path 

    String ChanageName= "Your changed Name";
    parent_path=parent_path+""+ChanageName; //setting path for renamed file to move to its original place.


    Entry RenamedFile    = mApi.move(FilePath, "/"+ChanageName);  //move to new place "/"
    Entry MoveRenameFile = mApi.move(RenamedFile.path,parent_path); //move to previous location

#1


9  

Your question title and body seem to ask slightly different questions, so I'll answer both:

你的问题标题和正文似乎问了一些略有不同的问题,所以我会回答两个问题:

You can edit a file (i.e., its contents) by uploading a new version of it, e.g., using the /files_put call:

您可以通过上传新版本的文件(例如,使用/ files_put调用)来编辑文件(即其内容):

https://www.dropbox.com/developers/core/docs#files_put

https://www.dropbox.com/developers/core/docs#files_put

You can rename a file or folder using the /filesops/move endpoint:

您可以使用/ filesops / move端点重命名文件或文件夹:

https://www.dropbox.com/developers/core/docs#fileops-move

https://www.dropbox.com/developers/core/docs#fileops-move

#2


0  

Don't worry about this, if you have a file and you want to rename it, then simply follow this logic it will solve your problem.

不要担心这一点,如果你有一个文件而你想重命名它,那么只需按照这个逻辑它就可以解决你的问题。

  1. Get Name of File and Change it and store the change name in string variable.
  2. 获取文件名并更改它并将更改名称存储在字符串变量中。
  3. Keep Parent Path of the original File.
  4. 保留原始文件的父路径。
  5. Move File to other place with the change Name get from String variable.
  6. 使用更改Name from String变量将文件移动到其他位置。
  7. Now move the File back from new place to old place,
  8. 现在将文件从新位置移回旧位置,
                 How to do it Programatically,
  Entry global_file;//assign any file to it 
  String FilePath=global_file.path;
  String parent_path=global_file.parentPath();//Keep parent path 

    String ChanageName= "Your changed Name";
    parent_path=parent_path+""+ChanageName; //setting path for renamed file to move to its original place.


    Entry RenamedFile    = mApi.move(FilePath, "/"+ChanageName);  //move to new place "/"
    Entry MoveRenameFile = mApi.move(RenamedFile.path,parent_path); //move to previous location