Page 1 of 1

php and folder operations on unix

Posted: Thu Mar 04, 2010 2:43 am
by tob1as
Hello everybody,

I have got a question concerning php and large file operations in unix.
I want to move folders with php from a directory to another.

That could be a whole folder tree with several files, for example 5gb or more.

I want to do this with an url that can be started remotly
example: http://.../move.php?source=developmentPlatform&destination=livePlatform&password=sha256hash

I know about the copy function of php, but it can be very slow and I run into timeouts sometimes.

I found out about the system commands, that you can embed in php to do unix operations.
Unfortunately I think system commands dont return any true or false in case of success or failure, which makes error handling and statehandling quite a challenge.

Is php the right language to do this? I read about perl but do not have any experience with it. Would you recommend perl and cgi?
How would you solve this problem?
Is there a way to get success or failure back from system commands to evaluate it in php?
Are there any ready-to-use-module that I could combine with my php modules?

thx for your answers and patience

toby

Re: php and folder operations on unix

Posted: Thu Mar 04, 2010 3:44 am
by VladSun
What about creating soft links instead of copying files?
E.g.:

Code: Select all

ln -s /home/development/oldVersion /var/www/currentVersion
...
rm -f /var/www/currentVersion && ln -s /home/development/newVersion /var/www/currentVersion
It won't take even a single second to perform this.