Loop through multiple folders
-
I have 25 directories, so to transfer each one, I currently:
1) Set the base path
2) Set the category to upload files to
3) Save settings
4) Import filesThus, it takes around 30 ~ 40 mins to update all the folders. And this has to be done weekly!
I’m wondering if it might be possible to amend the PHP such that it reads a main folder, and auto sets the path / categories
For example, I have:
Found_files/
Set1/
Set2/
…
..
Set25/Would it be possible to set the absolute path to “https://my-server/found_files”, and for the script to then reiterate through the folder, setting its own base path:
https://my-server/found_files/Set1
https://my-server/found_files/Set2
https://my-server/found_files/Set25The HTML within would be transferred to categories “Set1”, “Set2”, “Set25” etc within WordPress.
** Just spent the morning “pulling out” the fields on the option page, and the form code that submits the “Import” button. My idea was that I could create a program that would read the main directory, (such as OpenDir / ReadDir) create a form with all the fields set dynamically, (such as html_import[root_directory] updated on each loop) and submit to save settings each time, then run the IMPORT form to complete the process.
Now some values are set to ” ” whilst others only appear when an <div> option is chosen. Can’t work out if I need to submit ALL the fields – even if empty – or what are the minimum required fields.
(I am saving as “pending” with title set from filename: Only two options set, no Dreamweaver or HTML tags etc) And no idea at all what “_wpnonce” or “_wp_http_referer” does!!So before I spend 3 – 4 days trying to build a work around, I thought I’d check whether a solution already exists
- The topic ‘Loop through multiple folders’ is closed to new replies.