note 72413 deleted from ref.ftp by nlopess

From: Date: Wed, 17 Jan 2007 23:10:18 +0000
Subject: note 72413 deleted from ref.ftp by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-121857@lists.php.net to get a copy of this message
Note Submitter: admin at originxt dot com ---- This code logs into $ftp_server with $ftp_user and $ftp_pass (change them!) and CHMODs all the files and folders in $chmod_dir to $chmod_val. I used this to temporarily CHMOD all the files in my HTML folder so I can run a PHP script editing them. Use it wisely and strategically to save time! I had literally thousands of files to CHMOD and this did the job. <!-- FTP-powered file-chmodder: see http://originxt.com/node/15528 --><ol><?php $ftp_server = "ftp.originxt.com"; $ftp_user = "origin"; $ftp_pass = "---"; $chmod_dir = "/public_html/data"; $chmod_val = "0666"; // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); // try to login if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { $arr = ftp_nlist($conn_id, $chmod_dir); foreach($arr as $k=>$v) { echo "<li>Successfully CHMOD'ed $chmod_dir/$v to $chmod_val</li>\n"; ftp_site($conn_id, "CHMOD $chmod_val $chmod_dir/$v"); } } else { echo "Couldn't connect as $ftp_user\n"; } ?></ol>

« previous php.notes (#121857) next »