4

I've set up a logic app to move my new files on my FTP server to my azure storage container, which has blobs for my files. I found a way to create new folders using the storage explorer, but is there a way I can automate this using logic apps? For example, if a new folder is created in my FTP and files are added to it, I want to create a blob folder and move those files into that blob.

1 Answers1

6

First of all, Azure blob storage doesn't support folders. There is only your storage account and a list of container containing blobs.

What you can do is to simulate a directory by adding a name that contains a slash, e. g. uploading the following file:

/myVirtualFolder/test.txt

Will upload the file to your desired container and tools like storage explorer will parse the slashes and display them as a folder:

enter image description here

But if you check the metadata for test.txt, you will see that the actual file name is /myVirtualFolder/test.txt:

enter image description here

So all you have to do is to upload all your files from your target directory to the container by adding the virtual directory to its name. You can`t and don't have to create a folder first.

Martin Brandl
  • 56,134
  • 13
  • 133
  • 172
  • If I do `Create Blob` in my logic app and put a container name (that did not exist) in the blob name property I got an error: `Specified blob tmp/log1.txt does not exist.` If I put the container name in the folder path property I got the error: `Specified container tmp does not exist.`. Have you done this with an Logic App or does it work only with the Storage Explorer? – zgue Mar 21 '18 at 10:13
  • @zgue Sorry, not tested it with logic app yet. Maybe you have to create the container (a blob names tmp) first? – Martin Brandl Mar 21 '18 at 12:14
  • Thanks I will try it – zgue Mar 21 '18 at 12:27