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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Help Extracting Text F...
Power Automate
Answered

Help Extracting Text From Directory of PDFs

(0) ShareShare
ReportReport
Posted on by 11

Hello,

 

I built my first flow to get text from a PDF and use the text to rename the file.  It works when I specify an individual file but I'm having a hard time figuring out (and searching for) a solution to extract text from multiple PDFs in the same directory.

 

I've tried setting a variable of the directory path and referencing it in the "Extract text from PDF" step.

I've tried using various wildcards C:\directory\*.pdf and C:\directory\*

 

Each time the flow errors out saying that the file doesn't exist or that I need to specify a file and not a directory.

 

I would be grateful for any help getting my flow to run against all PDF files in a given directory.

2023-08-07 15_37_37-Window.png
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    16,548 Super User 2026 Season 2 on at

    Hi @tony_p ,

     

    Here's one option to consider and maybe @Agnius has a better solution.  In this example, you can get your *.pdf files into an array and then loop through each file with your current script.  As you mentioned, you are getting the results you want but want to make it dynamic and process each file regardless if there is one or one hundred.

     

    Please mark as a solution if this is helpful!  Always glad to help! Tom

     

    trice602_0-1691459372004.png

     

  • trice602 Profile Picture
    16,548 Super User 2026 Season 2 on at

    Here you would refer to the %files% so this step gets each pdf.

     

    trice602_1-1691459628080.png

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    The idea of using Get files in folder and a For each loop is correct.

    You would, however, need to reference the %CurrentItem% variable and not the %Files% variable in Extract text from PDF and Rename file(s) actions. %Files% stores the list of files, but the files must be processed one by one. And the current file for the current iteration of the loop is stored in %CurrentItem%.

     

  • trice602 Profile Picture
    16,548 Super User 2026 Season 2 on at

    100%, yes I was typing faster than I was thinking 🙂

  • tony_p Profile Picture
    11 on at

    With a couple of exceptions, this worked beautifully.  I think I ran into some text that couldn't be added to a file name in Windows but I got the majority of my files renamed automatically. 

     

    hank you @trice602 and @Agnius for the suggestions.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 247 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 164 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 138 Super User 2026 Season 2

Last 30 days Overall leaderboard