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 / Rename file in loop af...
Power Automate
Unanswered

Rename file in loop after OCR

(0) ShareShare
ReportReport
Posted on by

Hello,

my flow analyzes the photos in the folder and extracts some code, which is supposed to be the new name of this file. I have error in loop - access denied because other process using this file. I would ask for help

I have the same question (0)
  • Pavel_NaNoi Profile Picture
    1,074 on at

    Try putting in a 1 second "Wait" action after using OCR, might be just that the automation was running too fast.

  • Community Power Platform Member Profile Picture
    on at

    Still same problem

  • Pavel_NaNoi Profile Picture
    1,074 on at

    [IGNORE} Ah, found the issue, its because of the for each, you'll need another for each, do one with OCR that stores the number into a list until the list is filled up with all the numbers and then do a for each on the rename files action separately where it takes each file and renames it via the list you've filled up earlier (will need an index value for this) there's probably a much more clever way of pulling this off using lists instead of another for each but I'm unable to come up with one at the moment, feel free to try though.

  • Pavel_NaNoi Profile Picture
    1,074 on at

    Nevermind ignore my last post, It worked for a bit until it stopped working again, I'm not sure what's going on here.

  • Verified answer
    Pavel_NaNoi Profile Picture
    1,074 on at

    Please try the following:

    Pavel_NaNoi_0-1657203437761.png

    To explain in more detail as to what's going on is that:

    OCR or the For each hooks onto a file that you select, when it does this it will not let go until its called to do a different file, i.e. go onto the next file. Rename file (and other file actions) for some reason are a different type of hook that interferes with OCR and the For each, causing it fail, unfortunately there is no way that I know of to tell the OCR or the For each to just stop hooking onto a file (they might need to add that) so this is the best workaround I can give you, it uses loops instead of a for each to remove that from the equation entirely and to get past the OCR hook you'll need a dummy final file for it to scan (just copy paste one more file in manually before running the automation) otherwise you won't be able to rename the final file in your directory properly. Hope this helps.

  • Community Power Platform Member Profile Picture
    on at

    Thanks for help! It works! But before second loop I included get files in folder again then i haven't any errors. 

  • Community Power Platform Member Profile Picture
    on at

    I had the same problem, I put in a extra Extract text with OCR action, that just looked at a dummy file

     

    KristofferHov_0-1668775666107.png

     

  • Pavel_NaNoi Profile Picture
    1,074 on at

    Oh nice, I actually thought of doing that too, but it didn't work for me at the time for some reason, well done!

  • mohju Profile Picture
    5 on at

    Hi! I've tried copying the method first suggested but not sure how to configure some of the settings. Here is what my flow looks like. In the "create new list" none of the files in the filepath folder are being added. I also want to ensure the OCR is picking up the text only in a certain area of the image and using that as the file name. Any guidance will be helpful.

    mohju_0-1670448567626.png

     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard