Rename of multiple files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mcurry
Forum Newbie
Posts: 12
Joined: Tue Jan 21, 2003 3:41 pm

Rename of multiple files

Post by mcurry »

I am going to be moving multiple files often. Will it be more efficient to run a while loop and use the rename function or run one exec command with a wildcard. Any other pros/cons that I should be aware of if I use the exec function? This is in linux. Thanks.
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

In PHP, there are several different ways to execute system calls. Specifically, the system(), exec(), passthru(), popen(), and the backtick (`) operator all allow you to execute operating-system commands from within your scripts. Each of these functions can also, if used improperly, provide a wide-open door for a malicious user to execute system commands on your server. As was the case when accessing files, most of the time these security holes occur when a system command is being executed based on input from an insecure outside source.

http://www.onlamp.com/pub/a/php/2003/08 ... tions.html
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

He he he..what is this? A benefit to using Windows? NO WAY! :D
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

If I were you I wouldn't rename files using PHP at all.
Post Reply