PHP code to list folders in a directory and make them links…


I had a vision of listing all the folders within a web directory so that they were browseable – I.E if you have a parent site with lots of sub sites, how can you create a list that you can just click on to look at them?

The Solution was a snippet of PHP code I put together based on some useful online stuff, none of which answered the problem specifically, so here it is:


$dirs = array_filter(glob(‘*’), ‘is_dir’);
foreach ($dirs as $key => $val) {
    echo “<a href=’$val’>$val</a><br>n”;
I’m quite happy with that one!
The usage is at (note: the sites found here are only for development/ test purposes and are not “live”)

Updated Batch Installer Script

So it’s been around a year since I first created the automatic installer script for when we deploy new machines. And it has been a huge success, cutting down deployment time significantly, and meaning we can easily do more than one at a time.

I realised that as it’s been a year, and every product under the sun has a vulnerability in it, that I needed to update the script for the newer versions of the standard products we all know and love. Most notably Adobe Reader, Flash, Java Runtime and Microsoft Security Essentials. On top of these newer versions I also decided as our core business is based on JD Edwards, and it now supports Google Chrome that we should also have that included too.

Another addition that has been made is a simple file copy to create a new folder and put in standard internal documentation that helps people connect from home/customer sites and Accessing our proprietary software.

The latest updates are as follows:

@ECHO off

echo Installing Adobe Reader…

rem “[location]ProgramsStandard SoftwarenewpcAdobeRdr1000.exe” /sAll /msi /norestart ALLUSERS=1 EULA_ACCEPT=YES
rem instructions for compiling network installer can be found at:
msiexec.exe /i “[location]ProgramsStandard SoftwarenewpcAcroRead.msi” ALLUSERS=1 /q /norestart TRANSFORMS=”[location]ProgramsStandard SoftwarenewpcAcroRead.MST”
msiexec.exe /update “[location]ProgramsStandard SoftwarenewpcAdbeRdrUpd11003.msp” /qb /norestart
echo …done

echo Install ActiveX Flash…
rem “[location]ProgramsStandard Softwarenewpcflash_iexplore.exe” -install
msiexec /i “[location]ProgramsStandard Softwarenewpcinstall_flash_player_11_active_x.msi” /qn
echo …done

echo Install Browser Flash…
rem “[location]ProgramsStandard Softwarenewpcflash_firefox.exe” -install
msiexec /i “[location]ProgramsStandard Softwarenewpcinstall_flash_player_11_plugin.msi” /qn
echo …done

echo Installing Java Runtime…
rem “[location]ProgramsStandard Softwarenewpcjava.exe” /s
“[location]ProgramsStandard Softwarenewpcjava_new.exe” /s
echo …done

echo Installing Microsoft Security Essentials…
rem “[location]ProgramsStandard Softwarenewpcmse.exe” /s /runwgacheck /o
“[location]ProgramsStandard Softwarenewpcmse_new.exe” /s /runwgacheck /o
echo …done

rem –install chrome–
echo Installing Google Chrome…
msiexec /q /i “[location]programsstandard softwarenewpcchrome.msi”
echo …done

rem –Copy Useful Docs–
echo Copying BMS Useful Documents…
mkdir “%USERPROFILE%DesktopBMS Guides”
xcopy “[location]batch scriptsDocs*” “%USERPROFILE%DesktopBMS Guides” /Y /q
echo …done

rem –DONE–
echo Installer Complete!


I have left in the older code to compare the differences (if any) in the install commands.

The Adobe installs are now done using a great little utility which you can download from the Adobe website, this helps create a transform file which is basically a set of rules that define the install parameters. The adobe reader install needs a base install of Version 11 and then the update package on top, at time of writing update 3 is the latest, in theory when update 4 is available you should be able to download the file to the standard location and then change the code to reflect this version. The instructions I followed can be found here:

The Google Chrome MSI is available from here:

For security purposes I have modified the file paths for this post.