![]() ![]() ![]() ![]() on the List files in a Folder OneDrive action. To reduce this tedious process and increase the limit on the number of items returned in the List files from a folder action, upvote ideas created here to include fillter queries, top counts etc. If you have so many folders, you can tweak the flow a little bit by moving the folders to another folder and continue with the actions. Note that this configuration will only work until 20 Folders are encountered. of the deleted files can be captured in an HTML table and further sent out as an email to the relevant users. Details like file name, created by and created on etc. Use appdelete archive how to#In this flow, I showed you how to use the Do Until control to loop and get a set of items perform certain operations on the retrieved items and keep doing that until all the conditions on all the items for that connector are met. The variable value is being checked and it will run until there are no more files in the temporary folder.Īction: List files in a Folder 3: To list the files in the temporary folder.Ĭontrol: Apply to each 2: Iterate over each item returned in the list as an output from the above action.Īction: Move or rename a file 2: move the current file from the temporary folder to the base folder.Īction: List files in a folder 4: Again list the files from the temporary folder and store the count in the variable.Īction: Set variable 2: to store the count of the number of files returned in the list from the output of the above action. The expression used here is: length(body('List_files_in_folder_2')?)Īction: Initialize a variable 3: Initialize an integer type variable to store the count of files in the temporary folder.Ĭontrol: Do until 2: This control is to run until all the files in the temporary folder are moved to the base folder. The expression used here is: addDays(utcNow(),-15)Īction: Delete file: Provide the ID of the current item from the dynamic selector to delete this file.Īction: Move or rename a file: If the current file does not meet the condition, it is being moved to a temporary folder.Īction: Increment variable: If the current item is a folder, increment the folder count variable by 1.Īction: List files in a Folder 2: To get the fresh list from the OneDrive document libraryĪction: Set Variable: The value of the temp variable to store the count of items returned in the above action is set in this action. This is if the current item is not a folder.Ĭontrol: Condition: To check if the last modified of the current item is older than 'X' days (I am doing it for 15 days). I am using the root folder in this action.Ĭontrol: Apply to each: to iterate over each list item returned from the above action.Ĭontrol: Condition 2: To check if the current item is a Folder. Initially the value for this variable is set to 0 (mandatory) and will be incremented every time a folder is found in the list returned.Ĭontrol: Do Until: This control is defined to work until the number of files returned from the List files in a folder action is equal to the number of Folders encountered.Īction: List files in a Folder: Select the folder you want to perform these actions on. Initially the value for this variable is set to 100 (It is just a temporary value can be set to any integer other than 0)Īction: Initialize Variable 2: Initialize an integer type temporary variable to store the count of folders returned from the List Files from a Folder action. ![]() Trigger: Recurrence: I am using the recurrence trigger to trigger the flow everyday at 8 AM.Īction: Initialize Variable: Initialize an integer type temporary variable to store the number of files returned from the List Files from a Folder action. Lastly, all the files that were moved to the temporary folder will all be restored to the base folder. Note that we are doing this just for files in a folder not folders inside a folder. Now keep doing this until there are no more files left in the folder. If the file is older than ‘X’ days, delete it and if not, move it to a temporary folder. So here’s the high level architecture of this flow: List Files from a folder and check the modified date. There is no way (pagination settings are not working either) to get more than 20 items. The catch here is, the List Folder action on OneDrive gets you 20 items only. This looks like an easy task by simply listing the entire folder and set a condition to check the modified date and delete the older files. In this article, I will show you how to setup the flow configuration to delete files older than ‘X’ days from OneDrive. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |