Pdfs with a name including the variable

Hello, I’m a bit lost, I’m trying to do this and I can’t create it in app server

I have an import folder in which I have pdfs with a name including the variable that will be used to classify them in a specific directory.

Example :

2000011-764473-146613.pdf
2000113-764682-146608.pdf

I test if pdf are present in the import directory
(in the folder here are the files present:
2000011-764473-146613.pdf
2000113-764682-146608.pdf

if pdf are present then:
for each file I retrieve the variable, here for the first file 146613. I check that the content/146613 directory exists if it does not I create it if it exists I move the le to the content/146613 directory

then I do the same for the second file.

I was thinking of making a listing of the PDF files present in the import directory, to extract the file name and the variable, but I don’t know how to do it, any idea?

Thanks

Community Page
Last updated: