Rename new dropbox file to have the same name as it's containing folder
Is there a zap flow that would do the following:
When a new file is added to dropbox, rename the file to have the same name as it’s containing folder. So each new file should adopt it’s containing folder’s name. For anyone wondering, each folder will already have a unique name so there’s no issue of overwriting.
Page 1 / 1
Hi @kingcapital
Good question.
To detect new files a specific folder has to be specified.
But there is an option to rename a file.
Yes, but how do you rename the file to be the same name as its parent folder? That’s my question.
@kingcapital
FYI: With the limitation of the Dropbox trigger requiring a Folder be specified to watch for new Files, means a separate Zap would have to be configured for each desired Folder, plus multiple files in a single Dropbox Folder would result in being renamed with the same name.
For the renaming, there are 2 approaches.
Static
Since you have to specify 1 Dropbox Folder to watch per Zap, then you could simply add a static value in the Dropbox Rename File step since you already know what the Dropbox Folder name is that you want to use to rename the File to.
Dynamic
From the Dropbox New File in Folder Zap trigger, it will return the file path, that will include the parent Folder.
You can use a Formatter > Text > Split option to parse out the parent folder name.
Hey there @kingcapital, Troy is spot on as always! Zapier may be able help but not following the path one usually thinks about when building a Zap that does something like this, due to the limitations of the New File trigger.
Another way to think about approaching this - What if there was a single folder in Dropbox you uploaded all of these records to and Zapier both made the folder and then moved and renamed the file to match the folder name? Thanks to Troy’s screenshot, it looks like we do return the file name individually without the extension so your Zap could look like this:
Dropbox New File trigger => Dropbox Make Folder action => Dropbox Move File action => Dropbox Rename File action
This would require the file to have the unique name in question which might not at all fit your workflow as it exists presently. If the file would never be able to know that unique name, the trigger limitation may prevent a great solution in Zapier presently. However, if one can be flexible with the entire process or workflow prior to data reaching Zapier, we can usually make very robust solutions for novel problems!