Quick way to sort/renumber subdirectories?

[email protected]
Newsgroups php.general
Message-ID <CACOt7mEyDsjzoACWDKABL4ZB-CxuoDLh18KASSLdOkBrqOonVQ@mail.gmail.com>
Hello. I have an odd query, and im wondering if you can help.

I've got a directory structure 3 levels deep, with 3-digit numbers


023/001/001/(list of files)
023/001/002/(list of files)
023/002/001/(list of files)
023/002/002/(list of files)
024/001/001/(list of files)


num1 / num2 / num3 etc/..

Volume, issue, article, list of files in that article

The first two are fine, I'll not need to alter them when Ive set them.
BUT, the 3rd level could have half a dozen numbers, a dozen.
three-dozen etc.. (the highest number ive seen is in the 90's)

my question is, would there be an easy way to insert / renumber the
3rd level directory....

For example:

023/001/013/(list of files)
023/001/014/(list of files)
023/001/015/(list of files)
023/001/016/(list of files)


I want to insert a new directory in between 14 and 15 and then
re-number the directories higher, up a number

EG

023/001/013/(list of files)
023/001/014/(list of files)
023/001/014A/(list of files) << Inserted directory
023/001/015/(list of files)
023/001/016/(list of files)

renumbered:

023/001/013/(list of files)
023/001/014/(list of files)
023/001/015/(list of files) << Inserted directory - was 14A
023/001/016/(list of files) - was 15
023/001/017/(list of files) - was 16.

(I could in theory include  000A and that will become  001 and
everything else will go up a number)

OF COURSE, if i REMOVE 013, then the later numbers will REDUCE.

ISSUE: if I do add an "A" to the directory name, and I sort in
ascending order, i assume 001A comes after 001.  How can I force
sorting numerically, or alphabetically?


ISSUE: If i do create a small routine, to check the 2nd level
directory, locate a possible swap, and process ONE swap, and repeat
until therea re no more swaps. How do i avoid the error with too many
redirects - if ive got to check multiple times ?

if the URl changes - ?articlecheck=004  will that NOT get the redirect
loop error if I next check ?articlecheck=005 ??

QUERY: is there a quick way to re-order / re-mumber directories with a
single command (keeping the 3-digit directory names) ?? a possible PHP
process I've not remembered ?

-- 

Gordon.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.