🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #220474

Re: Rename + open_basedir restriction

#220474
From: Colin
Date: Tue, 08 Sep 2009 12:24
19 lines
1522 bytes
Ja wrote:
> To w takim razie co zmienić, żeby w pętli zmienić we wszystkich nazwach 
> plików (w jednym katalogu) znaki: %5B na [ , %5D na ] , a $20 na spacje?

<?php
$path = '/home/a68848/public_html/g/';
$dir = opendir($path);

while (($file = readdir($dir)) !== false)
{
  if ($file == '.' || $file == '..') continue;

  $sciezka = $path.$file;
  $zamiany = array('%5B'=>'[', '%5D'=>']', '%20'=>' ');
  $nowa_sciezka = $path.strtr($file,$zamiany);

  if ($sciezka != $nowa_sciezka) rename($sciezka, $nowa_sciezka);
}
?>
Technical Details
Message-ID: <h85iev$8hj$1@mx1.internetia.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mail
References: <h85gt8$j3a$1@news.onet.pl> <h85h64$fsp$1@atlantis.news.neostrada.pl> <h85hrv$lel$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mail
From: Colin <michkol@gmail.com>
Newsgroups: pl.comp.lang.php
Subject: Re: Rename + open_basedir restriction
Date: Tue, 08 Sep 2009 14:24:56 +0200
Organization: Netia S.A.
Lines: 19
Message-ID: <h85iev$8hj$1@mx1.internetia.pl>
References: <h85gt8$j3a$1@news.onet.pl> <h85h64$fsp$1@atlantis.news.neostrada.pl> <h85hrv$lel$1@news.onet.pl>
NNTP-Posting-Host: 77-254-87-229.adsl.inetia.pl
Mime-Version: 1.0
X-Trace: mx1.internetia.pl 1252412704 8755 77.254.87.229 (8 Sep 2009 12:25:04 GMT)
X-Complaints-To: abuse@inetia.pl
NNTP-Posting-Date: Tue, 8 Sep 2009 12:25:04 +0000 (UTC)
In-Reply-To: <h85hrv$lel$1@news.onet.pl>
X-Tech-Contact: usenet@internetia.pl
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
X-Server-Info: http://www.internetia.pl/news/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit