Link to home
Start Free TrialLog in
Avatar of Pedro Chagas
Pedro ChagasFlag for Portugal

asked on

List folders for edit some files inside that folders

Hi E's, I have a old project with about 10y, and in that time I do each page manually, the project was: http://rdsrc.us/fCIeXk, I don't use any dynamic language like php.
The problem is I have more than 100 folders, but I have the advanced that each folder have the same files, so is more easy edit the files inside them. The only thing I want to do to the files inside the folders was implement the code of google analytics, so I have to list each folder (maybe with a while), and edit the files I want in each folder.

For now I just want help to list all folder one by one, and in each while I edit the files inside the folder that I want.

How I list folder one by one?

The best regards, JC
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pedro Chagas

ASKER

Hi @ienaxxx, I try to use your script (I just change the line 2 to $dir = "/"; because I put I same location of folders), but the only thing I receive is:
===============================
filename: .rnd : filetype: file filename: usr : filetype: dir filename: .. : filetype: dir filename: . : filetype: dir filename: .autofsck : filetype: file filename: home : filetype: dir filename: aquota.user : filetype: link filename: aquota.group : filetype: link filename: sbin : filetype: dir filename: etc : filetype: dir filename: .gnupg : filetype: dir filename: boot : filetype: dir filename: srv : filetype: dir filename: tmp : filetype: dir filename: var : filetype: dir filename: scripts : filetype: link filename: .autorelabel : filetype: file filename: opt : filetype: dir filename: lib : filetype: dir filename: sys : filetype: dir filename: mnt : filetype: dir filename: bin : filetype: dir filename: media : filetype: dir filename: dev : filetype: dir filename: root : filetype: dir filename: selinux : filetype: dir filename: .spamassassin : filetype: dir filename: .lesshst : filetype: file filename: proc : filetype: dir
==================================

Where is the problem?

The best Regards, JC
PHP has a predefined and context-aware constant DIRECTORY_SEPARATOR that should be used in place of the "/".  It is there because some operating systems do not use a slash as a directory separator.

You might want to learn about this function.  Hint: It is one of the "Directory Functions" that are listed in the left sidebar of that page I suggested you should read.
http://us3.php.net/manual/en/function.getcwd.php
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial