This example uses the Official Dropbox API V2 SDK for Javascript to search and rename files.
-
Create an app via the Developer Console
-
In the Developer Console, navigate to the App Console > Your Application > Permissions to add
files.metadata.read
andfiles.content.write
permissions to your app scopes -
Install from the source:
git clone https://github.com/chriskyfung/dropbox-file-renamer.git cd dropbox-file-renamer npm install
-
Create a
.env
file in your project directory -
Generate and copy the access token from the App Console to
.env
file, for example:ACCESS_TOKEN=your_access_token
-
Open the
index.js
file in Visual Studio Code -
Modify the query string passed to the
filesSearchV2()
to search for your target files -
Modify the regular expression and replacement for the
filename.replace()
methods to generate the new filenames of the matched files -
Run the script using
node index.js
or
npm start
You can execute an example script using the following command in your terminal:
node ./example/[target-script-name].js
-
file_search_v2.js
- Searches for files and folders using the/files/search_v2
and/files/search/continue_v2
endpoints -
ilst_folder.js
- Lists the items of a folder using the/files/list_folder
and/files/list_folder/continue
endpoints
-
- search_v2Switch - [ Docs ]
- move_batch_v2 - [ Docs ]
Would you like to buy me a coffee? I would really appreciate it if you could support me for the development.
Distributed under the GNU Affero General Public License v3.0