Working with Files & Folders in Power Automate Desktop


Overview:

In Power Automate Desktop have Actions for File and Folder, to use File actions we can do automation such as  Delete, Copy, Rename, Move, Read & Write text/csv file also can be possible to get the file parts (directory, filename, file extension, etc)

and the same using Folder actions we can Create, Delete, Copy, Move, Rename Folder also can be possible to Get file in folder and Retrieve list of subfolders in a folder etc.

File:

1. Delete File(s) : This action is used to delete one or more files at a time by passing the file or folder path

a. To delete single file directly pass file path to delete


b. To delete multiple files from a folder, first need to use the action "Get files in folder" which will generate the variable as "Files" this need to pass within the Delete file(s) action.



Note : The above same procedure will be use to Copy file(s), Rename file(s), Move file(s) 

2. Get file path part : This action is used to retrieve one or more part from the file path. ex - directory, filename, file extension, etc.

3. Write and Read text file : This action is used to write or append the data to a text file and also to read the content from a text file.

a. Write text file
            enter file path, enter the text content to write, append to new file (select as per requirement), overwrite existing content or append the text in existing file(select from drop-down as per requirement), select encoding type.


b. Read text file
                File path : enter text file you want read
                Store content as : single text value/ List 
                Encoding type : UTF-8/ System default/ ASCII/ Unicode

Note : if Store Content type storing as List that data we can use "for each" to get the data for each row.


4. Read/Write from CSV file: 

       a. Write to CSV File : This action is used to write a data table, data row or list to a csv file.
       bRead from CSV File : This action is used to read a csv file into a data table.

*********************************************************************************

Folder: 

1. Create folder: This action is used to create folder.
                - Create new folder into :  path of the folder you want to create.
                - New folder name : enter the text or pass variable for folder name.

2. Delete folder: This action is used to delete folder.
                - Folder to delete : enter the folder path that need to be deleted.

Note : when you delete the particular folder along with that its subfolder and files are also deleted.

3. Empty folder: This action is used to delete all the content of a folder (files and subfolders) without deleting the folder itself.

4. Get files in folder: This action is used to Retrieve list of files in a folder.

                - Folder : choose full folder path 
                - File Filter : Choose a filter to list the files retrieves ( filter multiple extension file separating                                       with semi- colon eg : *.txt;*.xlsx  )
                - Include subfolder : specify whether to look into subfolders as well.
                - Advance : within advance we have options to sort files with (file name, directory etc.)




Happy Learning!! :)

Post a Comment

0 Comments