Convert URL Encoded DokuWiki Filenames to UTF-8

In response to a mailing list request

urldecode.php
<?php
 
$mode = 0775;  // permissions to use for directory creation
 
$src = $argv[1];
$dst = $argv[2].'/'.urldecode($argv[1]);
 
$path = dirname($dst);
if (!file_exists($path)) {
#    echo "mkdir -p $path\n";
    mkdir($path,$mode,true);
}
 
#echo "cp $src $dst \n";
copy($src,$dst);
; run from data/pages directory
; replace {NEW} with the name of a directory to receive the copied tree 
; ensure {NEW} isn't within data/pages :)
;
for wikipage in `find . -type f -name "*.txt"` ; do php urldecode.php $wikipage {NEW} ; done

The above command is effectively cp -R ./* {NEW} where all the destination paths/filenames are urldecoded versions of the source paths/filenames.