cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Automatically Sort Files based on a code in the name of the files

Hello, my name is David. I have been looking for a posted solution to my question but I didn't find one. 

 

We have started to use Teams and SharePoint to storage our data and to work on it. 

 

We receive files (word, excel, autocad, etc) from our engineering consultan. They send us packages of documents, we have created a folder in SharePoint and they have acces to it.  They upload those documents in folders with the same name and a correlative number. (NDE-001, NDE-002, NDE-003, NDE-00n and so on). Inside every folder there are documents. The document's name contains a code, for example:

"AAAA-BBB-CC-DD-000 - Document Description.docx"

AAAA: Project code

BBB: Área code inside the project

CC: Discipline

DD: Type of document

000: Correlative number

 

In our SharePoint we have folders to sort the documents that they upload in the NDE-XXX folders.

/SharePoint.com/Teams/AAAA/Documents/BBB/CC/DD/

 

I want to sort automatically the documents that they upload in the NDE-00N folders in our SharePoint.

 

For Example:

 

Imagine that we receive the NDE-001, in the following route:

/SharePoint.com/Teams/AAAA/Documents/Consultan/NDE-001/(FILES

 

Inside the folder NDE-001 there are 2 documents with the following name:

AAAA-110-EL-GN-DC-001 - Electrical Design Criteria.docx

AAAA-210-CV-ST-CR-001 - Civil Structural Transmisión Line Calculation Report.pdf

 

I want a Flow that create a copy of those documents in the respective folder:

/SharePoint.com/Teams/AAAA/Documents/EL/GN/DC/AAAA-210-CV-ST-CR-001 - Civil Structural Transmisión Line Calculation Report.pdf

/SharePoint.com/Teams/AAAA/Documents/EL/GN/DC/AAAA-210-CV-ST-CR-001 - Civil Structural Transmisión Line Calculation Report.pdf

 

I have an excel spreadsheet with all the project's documents maybe it can be used.

 

My written english is not perfect, so I hope I managed to explain myself properly.

 

Thank you in advance,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Automatically Sort Files based on a code in the name of the files

@DavidRHG 

 

@ScottShearer approach is wise, however, if for some reason you need to deploy a Flow in the way you described, please consider this approach. Note I have cloned the folder structure you described under a Teams site, path /Sharepoint Documents/General

 

Flow_redistributeFilesTeamsSharepoint_2.png

Cualquier problema, avísanos!

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

7 REPLIES 7
Highlighted
Dual Super User III
Dual Super User III

Re: Automatically Sort Files based on a code in the name of the files

Hi!

I think you need first to split your filename in order to get the info to build the target path. I would suggest to try this approach:

Flow_redistributeFilesTeamsSharepoint_1.png

Now, are all documents to be moved inside /SharePoint.com/Teams/AAAA/ ? Or, you need to take into account filename first 4 characters also -AAAA in your example- to build the target path?

 

Gracias!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Frequent Visitor

Re: Automatically Sort Files based on a code in the name of the files

Dear @efialttes 

 

Thanks for your answer.

 

The first field (AAAA) is the project name. And the SharePoint site is only for this project. So is not necessary to take into account to build the file path because it will be the same for all documents.

 

Por cierto.... hablo español. 

 

Thanks,

Highlighted
Super User III
Super User III

Re: Automatically Sort Files based on a code in the name of the files

@DavidRHG 

I agree with the comments made by @efialttes and they will help solve your issue.

However, I would like to suggest that you might be better of leveraging "out of the box" SharePoint features. 

Consider the following:

  • Save all of your documents at the root level of your library
  • Add add additional choice columns to you library.  Add choice columns for project code, area code, etc.
  • Require that these additional columns be completed when the documents are uploaded
  • Create SharePoint views that show documents grouped by Project code, then by Area code, etc.

Using this approach will be a much more simple approach.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Dual Super User III
Dual Super User III

Re: Automatically Sort Files based on a code in the name of the files

@DavidRHG 

 

@ScottShearer approach is wise, however, if for some reason you need to deploy a Flow in the way you described, please consider this approach. Note I have cloned the folder structure you described under a Teams site, path /Sharepoint Documents/General

 

Flow_redistributeFilesTeamsSharepoint_2.png

Cualquier problema, avísanos!

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
Frequent Visitor

Re: Automatically Sort Files based on a code in the name of the files

Hello @ScottShearer,

 

Thanks for your answer, I like your sugestion I will used it not to this issue but for others that I have. 

 

We are new using SharePoint and Teams so our expertise level is really low. My colleagues don't like to use the SharePoint interface so they syncronise the SharePoint Documents with their OneDrive folder to used it with their Windows Explorer. I know it's a waste of SharePoint's capabilities, but I hope that we would learn more and used it properly.

 

Thanks

Highlighted
Frequent Visitor

Re: Automatically Sort Files based on a code in the name of the files

Dear @efialttes,

 

Can you explain what does Compose? What should I put as input?

 

Thanks

Highlighted
Dual Super User III
Dual Super User III

Re: Automatically Sort Files based on a code in the name of the files

Hi again!


 

Can you explain what does Compose? What should I put as input?

 


No problema, yo do not need it.

I just copied you requirements description inside a dummy Compose action block, so I could easily check it when building my flow example 😁

Cualquier problema adicional, avísanos

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (5,436)