how to delete files in folder is there any activity to do it plz let me know how can i do this?
i want to delete only the files in the folder
check the reference
Hi @T_Y_Raju
Follow the below steps,
→ Use for Each file in folder activity to iterate the each file in the folder. Output is CurrentFile.
→ Inside for each insert the delete file activity and pass the CurrentFile to delete file activity.
Those activities will delete all the files in the folder.
Hope it helps!!
Follow these steps:
-
Drag and drop an Assign activity onto your workflow.
-
In the Assign activity, set the left-hand side to a variable of type String[] (an array of strings) to store the file names. Let’s call this variable filesInFolder.
-
In the Assign activity’s value field, use the following expression to get the file names in the folder:
Directory.GetFiles("YourFolderPath") -
Replace “YourFolderPath” with the path to the folder where you want to delete files.
-
Next, drag and drop a For Each activity onto your workflow.
-
Set the For Each activity’s TypeArgument to String, as we’re iterating through file names.
-
In the For Each activity, set the Values property to filesInFolder to iterate through each file name.
-
Inside the For Each loop, add a Delete File activity.
-
In the Delete File activity, set the Path property to the current file name (use the CurrentValue variable from the For Each loop).