web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Save screenshots by fo...
Power Automate
Unanswered

Save screenshots by folder - Power Automate Desktop

(0) ShareShare
ReportReport
Posted on by 340

Hi team, 

Need help! 

I'm able to save the screenshot by the name Ex - Amazon

Now, I would like to save those screenshots by folder 
Ex - Flow must create a folder for all the screenshots with Amazon & create another folder for all the screenshots with Walmart


Feel free to ask for more details, if my explanation isn't clear.

Thank you in advance.

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    So, I am assuming the following:

    • you can take the screenshot you want
    • you have already identified if it’s Amazon, Walmart, etc. 
    • Amazon, Walmart, etc is contained in the name of the each screenshot
    • You have all the screenshots saved to a single specific folder (we will call it %downloadfolder%

    I would design a process to put it in the right folder based on the name it contains.  If you determined Amazon or Walmart earlier, you that logic and assign the %Store% variable to each picture. So it essentially looks like this:


    get files from download folder

    for each file

    set the Store variable

    Switch Store (you can skip the whole switch process if you can determine the folder name based off the store variable such as %DestinationPath%/%Store%, the you could just skip Switch/Case and go directly to move file)

    Case Amazon

    set destination folder to Amazon folder

    Case Walmart

    set destination folder for Walmart

    (keep adding cases for all your different stores)

    Case Else

    If folder doesn’t exist

    Create Folder 

    End If

    Set destination folder (based off store name)

    End switch

    move file from download folder to destination folder

    end loop

     

  • mithushalk Profile Picture
    340 on at

    Thank you @MichaelAnnis!

    For better understanding, can you post the images of the flow?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You can paste this into a subflow:
    # Assuming all the screenshots are labeled ex. Amazon0001, Amazon0002, Walmart0001, etc. and saved to a specific folder (DownloadFolder). For my example, I will use the left 6 of the filenmae to determine the folder.
    SET DownloadFolder TO $'''Downloads'''
    Folder.GetFiles Folder: DownloadFolder FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    LOOP FOREACH CurrentItem IN Files
    Text.GetSubtext Text: CurrentItem CharacterPosition: 0 NumberOfChars: 6 Subtext=> Subtext
    # Here, if you can determine the Destination Folder from the subtext, then you can just go straight to Set Destination Folder as %DestinationPath%\%Subtext%. If not, then use the following Switch/Case scenario.
    SWITCH Subtext
    CASE = $'''Amazon'''
    SET DestinationFolder TO $'''C:\\Screenshots\\Amazon'''
    CASE = $'''Walmar'''
    # Notice the "Walmar"; the "Get subtext" earlier only grabbed the left 6 characters.
    SET DestinationFolder TO $'''C:\\Screenshots\\Walmart'''
    DEFAULT
    IF (Folder.DoesNotExist Path: $'''C:\\Screenshots\\%Subtext%''') THEN
    # If C:\Screenshots doesn't exist, create it and set the new folder to 'DestinationFolder'
    Folder.Create FolderPath: $'''C:\\Screenshots''' FolderName: Subtext Folder=> DestinationFolder
    END
    END
    File.Move Files: CurrentItem Destination: DestinationFolder IfFileExists: File.IfExists.DoNothing MovedFiles=> MovedFiles
    END

     

    MichaelAnnis_0-1636385672498.png

    MichaelAnnis_2-1636385717485.png

     

     

     

  • mithushalk Profile Picture
    340 on at

    @MichaelAnnis 

    My screenshot names are not static, they're dynamic.
    I take screenshots from hundreds of websites.

    I take a screenshot from the Amazon website then a folder Amazon has to be created & move all the Amazon named screenshots into the folder.
    Same applies for different screenshots & websites.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You name the screenshot when you take it, correct?

  • mithushalk Profile Picture
    340 on at

    I don't name it manually but based on the website name the screenshot will be adapted. So, it's completely dynamic.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Right, so, however it is named (if you gave me an example of a few, that would help), but my flow below would still work, you just might need to mess with how a screenshot name identifies to which folder it goes.  If you have hundreds of websites, then I would skip the switch functionality and go straight to:

     

    Get Files %AllScreenshots%

    For each %CurrentItem% in %AllScreenshots%
    Parse/Split/GetSubtext on %CurrentItem% to %DestinationFolderName%

    If %DestinationPath%\%DestinationFolderName% doesn't exist

    • Create Folder

    EndIF

    Move %CurrentItem% to %DestinationPath%

    End (For Each)

  • mithushalk Profile Picture
    340 on at

    Thank you @MichaelAnnis 

    I will definitely put this In my flow & get back to you.
    Could you please screenshot the demo for the latest solution?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Copy all the text below and paste it into you subflow.  These are actual commands. You can change the variable names after you paste it. I am not at my computer to give you screenshots.  Good luck:


    SET DownloadFolder TO $'''Downloads'''

    Folder.GetFiles Folder: DownloadFolder FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    LOOP FOREACH CurrentItem IN Files
    Text.GetSubtext Text: CurrentItem CharacterPosition: 0 NumberOfChars: 6 Subtext=> Subtext
    IF (Folder.DoesNotExist Path: $'''C:\\Screenshots\\%Subtext%''') THEN
    # If C:\Screenshots doesn't exist, create it and set the new folder to 'DestinationFolder'
    Folder.Create FolderPath: $'''C:\\Screenshots''' FolderName: Subtext Folder=> DestinationFolder
    END
    File.Move Files: CurrentItem Destination: DestinationFolder IfFileExists: File.IfExists.DoNothing MovedFiles=> MovedFiles
    END

  • mathiaskjeldsen Profile Picture
    224 on at

    Hi

     

    I have stumbled across a few of your screenshot issues by now. I hope you got it solved. For future reference and for others who might end up here, this demo might be of assistance:

     

    Take screenshots and store them in folders - Power Automate Desktop

     

    Best regards

    Mathias Kjeldsen

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard