Hi Bulliver, others,
Thanks for your tip about my script. I think Perl might be the way to go on this one, since I believe it can be executed from the command line or as a CRON job...Admittedly, I really have no clue how to code Perl, just a general understanding of it through countless trial and error efforts.
I've found the a script for my first step, named splitfile.pl, which is invoked by the following:
Step 1:
[root@]# perl splitfile.pl -l 500 wordlist.txt file
Where -l = lines for each file, then source file, then output file prefix
I'd list the URL for the source, but I don't have sufficient privileges yet.
In my next step, I originally wanted to call a command line function that counts the number of files created, then uses that count to pull random new folder names from a text list of possible names.
Bulliver pointed out the error with this step: there is a chance that the same new folder name could be pulled from the list, thus screwing up the whole process.
So, now I will simplify it, but I don't know the perl for doing the rest:
Step 2: Collect all file names created by the split process, for example: fooaaa, fooaab, fooaac but *without* the .txt extension for now - basename I think...
Step 3: Go to a selected web directory and create new folders named according to the filenames collected in step 2; for example /var/www/user1/web/fooaaa , then make /var/www/user1/web/fooaab , /var/www/user1/web/fooaac etc. Make sure to create a folder for each name...
Step 4: After all folders have been created, go to the first folder, fooaaa, and copy files from a predefined source on the server: example copy /home/sourcefilesandfolders/*.* to /var/www/user1/web/foooaaa/ .
Step 5: Among the folders and files copied to these new directories will be a sub-folder named: abc , such that the complete directory path to folder abc would be: /var/www/user1/web/fooaaa/abc . Now return to the directory containing the split files and move file fooaaa to /var/www/user1/web/fooaaa/abc/mylist.txt - making sure to rename it to mylist.txt .
Repeat in the same fashion for each remaining split file, moving it to sub-directory abc with name mylist.txt of the folder that was created with its original "split name"...
In the end, we would have:
/var/www/user1/web/fooaaa/abc/mylist.txt
/var/www/user1/web/fooaab/abc/mylist.txt
etc.
Step 6: Chmod all /var/www/user1/web/foo* folders to 755
Step 7: Open crontab for user1 and begin with the following commands:
Code:
0 0 * * * /usr/bin/php /var/www/user1/web/fooaaa/abc/myphpfunction.php
Step 8: Starting at Cron time 0 0 * * * . Write command for myphpfunction.php for each foo* directory created, but for each successive command, increment the Cron Exec time by 5 minutes. When 12 sets have been written to the crontab, increment hour value by 1 (since 12 x 5 minutes = one hour has past) and continue until commands for *every* folder created have been written...
It is not likely that 24 hours worth of new folder commands will be needed, since this would be 12/hour x 24 hours equaling 288 unique commands, which is essentially 288 new foo* created folders.
Thanks again for the help!