I'm stuck (again). Here is my problem: I need to store files which a user uploads to the server in a specified directory and with a 'sensible' name, ie one that I create. What I want to do is create a script which does all the naming for me. Basically all the files will have the same prefix, it will only be the ending which will be different. For example:
Notice the increment (1, 2, 3, 4). How would I do this? I have made an attempt at this but I'm unsure as to how I would continue. Here are some ideas which I have so far:
1. Change to the correct directory for files.
2. Read all of the files in the directory and see what
the increment is currently at eg 4 for TXT4.
3. Rename the uploaded file to the filename which is one more than
the last eg TXT5.
2.1 Split the names of the files into separate parts, the prefix (TXT)
and the suffix (increment number). Find the highest suffix and
3.1 Create the filename by concatenating TXT and the increment number
I know that Perl is good for this sort of thing, so this message is cross-posted to the Perl forum.
Many thanks for all help and suggestions.