Article View: pl.comp.lang.php
Article #220476Re: Rename + open_basedir restriction
From: Ja
Date: Tue, 08 Sep 2009 14:02
Date: Tue, 08 Sep 2009 14:02
25 lines
1653 bytes
1653 bytes
Colin pisze:
> 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);
> }
> ?>
Ten skrypt dobrze działa, ale właśnie natrafiłem na dodatkowy problem. W
niektórych nazwach mam %27, który trzeba zamienić na '
Mógłbyś mi podpowiedzieć jak to zrobić?
Technical Details
Message-ID:
<h85o5j$8kq$1@news.onet.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mailReferences:
<h85gt8$j3a$1@news.onet.pl> <h85h64$fsp$1@atlantis.news.neostrada.pl> <h85hrv$lel$1@news.onet.pl> <h85iev$8hj$1@mx1.internetia.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail From: Ja <fm24@poczta.onet.pl> Newsgroups: pl.comp.lang.php Subject: Re: Rename + open_basedir restriction Date: Tue, 08 Sep 2009 16:02:18 +0200 Organization: http://onet.pl Lines: 25 Message-ID: <h85o5j$8kq$1@news.onet.pl> References: <h85gt8$j3a$1@news.onet.pl> <h85h64$fsp$1@atlantis.news.neostrada.pl> <h85hrv$lel$1@news.onet.pl> <h85iev$8hj$1@mx1.internetia.pl> NNTP-Posting-Host: 89.108.245.170 Mime-Version: 1.0 X-Trace: news.onet.pl 1252418547 8858 89.108.245.170 (8 Sep 2009 14:02:27 GMT) X-Complaints-To: niusy@onet.pl NNTP-Posting-Date: Tue, 8 Sep 2009 14:02:27 +0000 (UTC) User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: <h85iev$8hj$1@mx1.internetia.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit