cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VeeLearnMSFT
Post Partisan
Post Partisan

Move files from one folder to another based off an excel list

Stuck a bit, can someone help me finish this flow.  I basicallly want to move the files from one folder to another based off the file names identified in the excel document.  I can grab the current item in the excel file but I just dont know how to match it against the files in the folder and then move them.  Any help someone can offer?

VeeLearnMSFT_0-1651173684702.png

 

The exel file has just one column.

VeeLearnMSFT_1-1651173784416.png

 

 

6 ACCEPTED SOLUTIONS

Accepted Solutions

Move Files should be %CurrentItem1% (this is the full path and Filename with extension) to %CurrentItem0[0]%. (The folder code, but you also need the rest of the address in front ex. C:\Clients\%CurrentiItem0[0]%

View solution in original post

Ah apologies, should've mentioned that, its written like this inside %""% this causes it to get rid of any null characters, as "%""%" is the way PAD interprets null characters.

View solution in original post

Apologies for the late reply, this is some what weird, the only reason I can come up for this is that the file names in excel has like a space / white space at the end of the name, you could try using another replace before the first one and regexing for just "\s" in the excel names which is the whitespace char, and then replacing it with %""% for null. See if that works.

View solution in original post

VJR
Super User
Super User

 

If that is the case as suggested by @Pavel_NaNoi  then use the string function to remove any unwanted characters.

 

VJR_0-1651283092031.png

 

View solution in original post

I tried that as well.  I have no idea why it is not doing a compare.  Anything else I can try? 

@VJR can you do a mock up of the solution you provided.  I could not get yours work as well. Sorry guys I am just too new and struggling.

 

VeeLearnMSFT_0-1651320274079.png

 

View solution in original post

I figured it out..I think I had a space before the "%Files% \".  that was part of the issue.  I removed the trims and it works! Thank you guys for being so patient with me. I think bottom line was I had to struggle with this. Thanks for pushing me!

View solution in original post

15 REPLIES 15
MichaelAnnis
Super User
Super User

We need to do a zoom call on this, cuz we can get something faster for you. 

For now, use %CurrentItem[1]%; this is the Filename in the current row of Excel. %CurrentItem[0]% is the folder code.

 

you need two loops

For Each %CurrentFile% in %Files%
    For Each %CurrentItem% in %ExcelData%
        if %CurrentItem[1]% = %CurrentFile.Name%
            Move %CurrentFile% to ‘whatever address using %CurrentItem[0] for the folder code

            Exit (For Each), we don’t need to keep looking through Excel if we found a match.

        End IF

    End For Each

End for each

good luck

VJR
Super User
Super User

- Launch Excel

- Read From Excel 

- For Each  

  • Move File From Source to Destination
  • If Count of MovedFiles is = 0 then it means file was not moved.
  • Else File was moved
  • Loop will automatically pick up next file from the Excel

End

 

 

VJR_0-1651203817172.png

 

 

The "IF" is just an example. You can skip it if you don't need.

VeeLearnMSFT
Post Partisan
Post Partisan

Cannot get this one to work:

 

VeeLearnMSFT_0-1651231729402.pngVeeLearnMSFT_1-1651231806026.pngVeeLearnMSFT_2-1651231855255.png

 

Your move file does not show full file name and extension.

While moving please add full path with file name and extension.

Append it to the Excelvalue. 

Michael I am missing something.  Please tell me if I have not provided enough data.

VeeLearnMSFT_0-1651233550644.png

 

Move Files should be %CurrentItem1% (this is the full path and Filename with extension) to %CurrentItem0[0]%. (The folder code, but you also need the rest of the address in front ex. C:\Clients\%CurrentiItem0[0]%

VeeLearnMSFT_0-1651241095491.png

 

What did I mess up?

Pavel_NaNoi
Responsive Resident
Responsive Resident

Here's a much more clever way of doing this, it will save you minutes as you won't even need a for loop:

Pavel_NaNoi_0-1651241118659.png

Use the comments in the image to follow along, but what this basically does is it finds the beginning of a line inside each of the pdf names from the excel file then gives them the file path of the folder housing the .pdf files on your PC, splits them into a list and matches it with the list from the "Get files in folder" action, after which it only moves the matched files.

 

Hope this helps, feel free to ask anything else if you're stuck.

I am not having the greatest day today as I cannot get any of these solutions to work.  This is definitely a user error, just need to buckle down and figure this out.

 

VeeLearnMSFT_0-1651258164797.png

I am having a hard time reading the Remove item from list.  What is the character after "Remove all occurrences of item ..

Ah apologies, should've mentioned that, its written like this inside %""% this causes it to get rid of any null characters, as "%""%" is the way PAD interprets null characters.

Still Struggling.  cannot get it to work.  I notice for example file Claringbold matches but its not picking it up in intersection list.  I know its something silly that I am not paying attention to.

VeeLearnMSFT_2-1651263340653.png

 

VeeLearnMSFT_1-1651263283557.png

 

 

Apologies for the late reply, this is some what weird, the only reason I can come up for this is that the file names in excel has like a space / white space at the end of the name, you could try using another replace before the first one and regexing for just "\s" in the excel names which is the whitespace char, and then replacing it with %""% for null. See if that works.

VJR
Super User
Super User

 

If that is the case as suggested by @Pavel_NaNoi  then use the string function to remove any unwanted characters.

 

VJR_0-1651283092031.png

 

I tried that as well.  I have no idea why it is not doing a compare.  Anything else I can try? 

@VJR can you do a mock up of the solution you provided.  I could not get yours work as well. Sorry guys I am just too new and struggling.

 

VeeLearnMSFT_0-1651320274079.png

 

I figured it out..I think I had a space before the "%Files% \".  that was part of the issue.  I removed the trims and it works! Thank you guys for being so patient with me. I think bottom line was I had to struggle with this. Thanks for pushing me!

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Top Kudoed Authors
Users online (2,599)