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

rad menu , check if item text exists

vb.net telerik radmenu

Using telerik and the radmenu, do you know how to check if the item exists by text

C# How to upload large files to ftp site

c# upload ftp windows-applications

I am developing an windows application for backup(Files and sql server database).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.