[Israel.pm] Renaming folder using perl

Avishalom Shalit avishalom at gmail.com
Tue May 5 06:45:15 PDT 2009


ok, so this guy goes to the doctor and says (pointing),
doc it hurts here , and here, and here, and here , and also here.
so the doctor says , "your finger is broken"

---
why are you trying to rename the folder you are in.
can you not change the design  ?

i can think of rube goldberg equivalents in software that would allow this,
(e.g. have your script write some parameters to an instruction file, then exit,
 and have a cron job occasionally check that file for instructions and
run a perl script from the outside to handle that, and then clear the
instruction file)

cheers.
--vish

2009/5/5 Berler Chanan <chananb at centerity.com>:
> 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
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>



-- 
-- vish


More information about the Perl mailing list