Anirudh B
Anirudh B

Reputation: 39

Concat filepath & filename in Logic App to delete file from SFTP VM

Concat filepath & filename in Logic App to delete file from SFTP VM.

Using Connector In logic App:- "SFTP-SSH"-->"Delete file"

My static path would be /a/b/c/"child directories"/"filename"

Child directories-will be having Multiple child dir like -1,2,3.. & with dynamic filename.

Upvotes: 0

Views: 1295

Answers (1)

Hury Shen
Hury Shen

Reputation: 15744

Below is my logic app, you can refer to the screenshot.

enter image description here

You just need to use "List files in folder" action to list all of the child directories under the "/A/B/C" and then use "For each" to loop the body from "List files in folder". In the "For each" action, concat the path and the filename and do the delete operation.

Need to explain, the structure of my sftp directory is:

upload
  A
    B
      C
        childdirectory1
           file1.csv
           file2.csv
        childdirectory2
           file1.csv
           file2.csv
        childdirectory3
           file1.csv
           file2.csv

By the way, in the "For each" action, you'd better do this configuration as below (click the "..." button in the upper right corner of "For each" --> click "Settings" and then enable "Concurrency Control" and set the "Degree of Parallelism" to 1): enter image description here

Hope it helps~

Upvotes: 1

Related Questions