php and folder operations on unix

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
tob1as
Forum Newbie
Posts: 1
Joined: Thu Mar 04, 2010 2:22 am

php and folder operations on unix

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: php and folder operations on unix

Post 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.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply