I need to open files on a windows file server with php. Unfortunately there are over 700k files, and they did all sorts of typical windows filename stuff. Comma’s, apostrophe’s, ampersand’s, parenthesis, spaces, etc…. Just about anything you can think they did to these file names they did it. Does anyone have a routine/function/etc…. that will escape everything that could possibly need to be escaped to turn this into a valid linux path so my php script can open each of the 700k files?
Thanks!
Greg
Currently I’m using this…. 1, it’s ugly. 2, it’s growing every time I come across something else they did…
$path = preg_replace('/s+/', '\ ', $path);
$path = preg_replace('/(/', '\(', $path);
$path = preg_replace('/)/', '\)', $path);
$path = preg_replace('/'/', '\'', $path);
$path = preg_replace('/,/', '\,', $path);
$path = preg_replace('/&/', '\&', $path);