a need to parse file names to cli
i have a php script where i need to create a zip archive with an array of file names
so I do this running zip via php; using shell_exec().
i hit a bump when it comes to files which has names like
/var/www/someone's file (3)
cause my zip command looks like
shell_exec("zip -r -j myzip.zip /var/www/someone's file (3)");
now i need a way to parse the file names so it looks like
/var/www/someone\'s\ file\ (3)
any help on this is much appreciated and is there any function which can do this directly ?
You're looking for escapeshellarg().