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 ?

Answers


You're looking for escapeshellarg().


Need Your Help

How to get a full call stack in Visual Studio 2005?

c++ visual-studio debugging callstack visual-c++-2005

How can I get a full call stack for a c++ application developed with Visual Studio 2005? I would like to have a full call stack including the code in the system libraries.

Set one or more of coefficients to a specific integer

r lm

I am using a standard lm model and would like to set the coefficients of one or more of my variables to a specific integer.