[Israel.pm] Renaming folder using perl

Berler Chanan chananb at centerity.com
Tue May 5 06:14:34 PDT 2009


I can't see why this information will help
Since rename function was supported long ago...the idea is simple
How to change the current folder name ?

PS: 
you are right however that unix support rename ../myfolder
../mynewfoldername
While windows doesn't. So I would have replied: 
OS = win / unix
Error: permission denied (since windows locks the folder name if there is
someone inside it (like my script which is running).

You see, using `cd ..` and then `rename myfolder mynewfoldername` - doesn't
work for me
Same goes when using system function

Thanks
Chanan

PS: as for your code...sorry but there isn't yet anything, just looking for
a solution
But thanks again for your help

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of Gabor Szabo
Sent: Tuesday, May 05, 2009 12:42 PM
To: Perl in Israel
Subject: Re: [Israel.pm] Renaming folder using perl

On Tue, May 5, 2009 at 2:15 PM, Berler Chanan <chananb at centerity.com> wrote:
> Hi All,
>
> I need to write a script that renames the folder the script is running
from:
> The idea to rename the current folder to a back_<localtime>, then download
a
> zip file and extract it
>
> (the main Idea to replace the current agent with another nagios agent).
>
> Problem: how can I rename the current folder the script is running from ?
> trying rename function fails (like system rename).

Can you show us
Operating system ?
Perl version ?
Error message you get ?
Your code ?

Gabor
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://mail.perl.org.il/mailman/listinfo/perl
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.238 / Virus Database: 270.12.4/2081 - Release Date: 05/04/09
17:51:00



More information about the Perl mailing list