Loop Thru and Rename Files
Posted: Thu Aug 08, 2002 7:20 am
Hi,
I'm having a script that includes all the files in a directory. The files are calles file1, file2, file3 and so on. So the include script is just a loop starting at 1 and goes on untill theres no files left. But that's not the problem.
The problem is that i'm making an online admin section where I should be able to delete a file. One of the file1, file2, file3 and so on. But if I delete on of this then the include script want loop thru the all. Let's say I delete file2. Then the include script will loop only once and out put file1. But in the directory there are 15 files. Now called file1, file3, file4 and so on because the file file2 is deleted and the include script stops when a file doesn't exist.
I nees to make something that will loop thru and rename alle the files to file1, file2, file3, file4 and so on. So that the include script will work.
One solution i've though of is to set the include script to count have many files there are in the directory and the loop that many times, but i haven't got that to work either.
Could someone please help me??
I'm having a script that includes all the files in a directory. The files are calles file1, file2, file3 and so on. So the include script is just a loop starting at 1 and goes on untill theres no files left. But that's not the problem.
The problem is that i'm making an online admin section where I should be able to delete a file. One of the file1, file2, file3 and so on. But if I delete on of this then the include script want loop thru the all. Let's say I delete file2. Then the include script will loop only once and out put file1. But in the directory there are 15 files. Now called file1, file3, file4 and so on because the file file2 is deleted and the include script stops when a file doesn't exist.
I nees to make something that will loop thru and rename alle the files to file1, file2, file3, file4 and so on. So that the include script will work.
One solution i've though of is to set the include script to count have many files there are in the directory and the loop that many times, but i haven't got that to work either.
Could someone please help me??