Question

How to automate renaming Dropbox files based on filename changes in a specific Airtable field?

  • 25 September 2023
  • 20 replies
  • 178 views

Badge

Looking to create an automation that will rename files in Dropbox when their filename has changed in Airtable, but the Dropbox action only seems to allow me to chose from attachment fields in the Airtable table (presumably it takes the filename of the attachment and looks for that in Dropbox) but I’d rather use a text field as the “File Name” to search for in Dropbox (actually, not a text field but rather a lookup pulling from a different table than the one used in my trigger).

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

20 replies

Userlevel 7
Badge +14

Hi @ASKproduKtion 

Good question.

Perhaps try this…

If you save the Dropbox File ID into an Airtable field after it is first uploaded to Dropbox, then you won’t need the Dropbox Find File step.

Badge

OK, but in that case I would need a way to find the record in AT corresponding to the filename added to Dropbox. Do you think there’s a way to do that?

Anyways, seems strange that the Dropbox find file can’t simply take a string input as the Filename to search for

Userlevel 7
Badge +14

@ASKproduKtion 

Perhaps you can outline a specific example for us to better understand with screenshots from the fields in Airtable and Dropbox.

Basically a before and after for the inputs and expected outputs.

Badge

OK, I have figured out how to map the Dropbox path to the correct “asset” record in AT when I upload a new file to a dropbox folder

Basically, I have a table called 4/assets that would track various stages of post production on files, with each stage living in a certain Dropbox folder. When I upload a file to the Dropbox folder “test” it was able to lookup the filename and add the path

 

Badge

I guess I could use that path in a subsequent Dropbox action if I needed to rename the file?

Badge

Mapping the dropbox paths into AT is useful overall, so I can know where all the files are living. But I would just like to turn back to my initial question. Wondering why a Dropbox action to rename a file cannot pull a string input?

The main reason I would need to change filenames in Dropbox is if the “item ID number” changed, which sometimes happens due to data integrity issues on the merchant side of our team. There is a table called 2/variants where the “item ID” fields live, then flow over to the table 4/assets where they are incorporated into the asset filename. So, if item ID 33301 was updated to 33302, I would want to change all the files in Dropbox so it would be great if the Dropbox action could just search for them. Otherwise, I would have to use the pathID setup above to find each specific file and rename it

 

Badge

so, I’d really love to be able to search for files to update instead of having to send all the paths

 

Userlevel 7
Badge +14

@ASKproduKtion 

Airtable only returns fields in the trigger step that have data populated for a field.

 

This is a Lookup field in Airtable.

This appears to show multiple values separated by commas.

You can use the Looping app to iterate thru each: https://zapier.com/apps/looping/help

 

Badge

“Airtable only returns fields in the trigger step that have data populated for a field.”

» donyou mean that because theblookup field contains an array of values, AT is not returning it in the trigger step? the lookup field does have data, its just an array

will look into looping thanks 

Userlevel 7
Badge +14

@ASKproduKtion 

Airtable Zap triggers/actions will return lookup fields if those fields have values.

Make sure you are using an Airtable record from the Zap trigger step that has those values populated.

How to change the Zap trigger data: https://help.zapier.com/hc/en-us/articles/8496310366093

You may want to configure a View in Airtable that has a Filter condition where the field is not empty.

 

Badge

Hi Troy, but the lookup field I am trying to use is NOT empty… it is however an array of values

 

Userlevel 7
Badge +14

@ASKproduKtion 

We’ll need cross referenced proof via screenshots.

Can you show screenshots with the DATA OUT from the Zap trigger step that show the Record ID and those values?

Can you show the matching Record ID in Airtable with the Lookup field populated?

 

You can add a Record ID to your Table as a Formula Field:

Creating a record ID field Open your preferred base. Click the + icon to the right of your desired table. Select the Formulafield type and enter RECORD_ID() . Click Create field.

Badge

trying to send replies it keeps saying “Please wait for your files to be uploaded” and then I lose everything I wrote in the reply

Badge

Hi Troy

1/ here is the field “item ID mod” in the table “2/variants” that I am watching for my Airtable trigger

 

Badge

2/ here is the record ID “recOpZMli2cc97qTn” that was found in the test

 

Badge

3/ here is the record recOpZMli2cc97qTn that shows it has a value (an Array of filenames) for the field “filename // variant in asset” that I would like to pass to the Dropbox action as “File Name” to find

 

Badge

4/ alas, the Dropbox action won’t let me choose the field “filename // variant in asset” to pass as the “File Name” it only seems to show me attachment fields (presumably because it is trying to grab the filename of the attachments?) is it not able to pull a string or better yet an array of strings?

 

Userlevel 7
Badge +14

@ASKproduKtion 

Make sure to pull thru the freshest examples, so click the button for [Find new records].

The try searching for “filename” or a value from the cell to see if that matches any of the returned data points.

 

 

Badge

Hi Tony, back to this original statement of yours “If you save the Dropbox File ID into an Airtable field after it is first uploaded to Dropbox, then you won’t need the Dropbox Find File step.”

I am now pulling the Dropbox File ID into an Airtable field as files are added into the Dropbox folder, by matching against the “filename” field I have in Airtable.

Now I have solved some of the other problems, but am trying to use the Dropbox File ID to update the filename of a file in dropbox that is “registered” in my Airtable when the “filename” field is updated I wan’t to change the filename of the corresponding file in Dropbox and using the Dropbox File ID to locate the file (because by definition the filename is different since that’s what I need to update) but I am getting the error “Failed to create a file in Dropbox // File/Folder not found”

Any ideas why this is failing?

 

Userlevel 7
Badge +11

Hi there @ASKproduKtion! 👋

The File field in the Rename File action for Dropbox works a bit differently in comparison to most fields when using the custom value option. Instead of referencing the file by it’s ID number you’d need to reference it by it’s path. For example:
1f2ae2e04a812358bd79935c5014156a.png

Are you also storing the path to the file in Airtable? If so, you can select the path instead of the ID for the file and that should allow the Rename File action to successfully find and rename the file.

And you’ll also want to remove the file extension from the New Name field:
3473560e063c4e99459d65a3940b622c.png
Entering a file extension there will not change the current file extension it will just be considered part of the name that needs to be altered. For example if the New Name field contains ___0081-1.jpg the jpg file would actually be renamed to ___0081-1.jpg.jpg

Can you give those changes a try and let us know if that fixes things?