Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   problem cp (http://www.velocityreviews.com/forums/t901978-problem-cp.html)

john.swilting 02-23-2007 11:25 AM

problem cp
 
how to make a function cp
who would go like
I read the name of the old file I it copis in a variable $variable I
re-elect the new file and I copy it towards the old file while keeping the
same name of the file

john.swilting 02-23-2007 11:26 AM

Re: problem cp
 
john.swilting wrote:

> how to make a function cp
> who would go like
> I read the name of the old file I it copis in a variable $variable I
> re-elect the new file and I copy it towards the old file while keeping the
> same name of the file

en français
je lis le nom de l'ancien fichier je le copis dans une variable $variable je
renomme le nouveau fichier et je le copie vers l'ancien fichier tout en
gardant le meme nom du fichier

john.swilting 02-23-2007 11:54 AM

Re: problem cp
 
john.swilting wrote:

> how to make a function cp
> who would go like
> I read the name of the old file I it copis in a variable $variable I
> re-elect the new file and I copy it towards the old file while keeping the
> same name of the file

why not

open (FH , $old_fichier);
select(FH);
rename $new_fichier, $old_fichier;
`cp $new_ficier /image1`

its nice that

john.swilting 02-23-2007 12:39 PM

Re: problem cp
 
john.swilting wrote:

> john.swilting wrote:
>
>> how to make a function cp
>> who would go like
>> I read the name of the old file I it copis in a variable $variable I
>> re-elect the new file and I copy it towards the old file while keeping
>> the same name of the file

> why not
>
> open (FH , $old_fichier);
> select(FH);
> rename $new_fichier, $old_fichier;
> `cp $new_ficier /image1`
>
> its nice that

not
open (FH , $old_file);
select(FH);
rename $old_file ,$new_file;
`cp $new_file /image1`;


I had to reverse the files in the rename

john.swilting 02-23-2007 12:41 PM

Re: problem cp
 
Michele Dondi wrote:

> On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
> <john.swilting@wanadoo.fr> wrote:
>
>>open (FH , $old_fichier);
>>select(FH);
>>rename $new_fichier, $old_fichier;
>>`cp $new_ficier /image1`
>>
>>its nice that

>
> IMHO you want either to do it all in Perl or use OS native commands
> altogether. Personally, I would perfer the former.
>
>
> Michele

ok

File::*

all
its nice

john.swilting 02-23-2007 02:32 PM

Re: problem cp
 
Abigail wrote:

> Michele Dondi (bik.mido@tiscalinet.it) wrote on MMMMCMXXIV September
> MCMXCIII in <URL:news:vtntt2ptjjljafukbpp1bsiqse57i1vbg0@4ax.c om>:
> && On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
> && <john.swilting@wanadoo.fr> wrote:
> &&
> && >open (FH , $old_fichier);
> && >select(FH);
> && >rename $new_fichier, $old_fichier;
> && >`cp $new_ficier /image1`
> && >
> && >its nice that
> &&
> && IMHO you want either to do it all in Perl or use OS native commands
> && altogether. Personally, I would perfer the former.
>
>
> I very much prefer the latter.
>
>
>
> Abigail

why

john.swilting 02-23-2007 02:34 PM

Re: problem cp
 
john.swilting wrote:

> Abigail wrote:
>
>> Michele Dondi (bik.mido@tiscalinet.it) wrote on MMMMCMXXIV September
>> MCMXCIII in <URL:news:vtntt2ptjjljafukbpp1bsiqse57i1vbg0@4ax.c om>:
>> && On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
>> && <john.swilting@wanadoo.fr> wrote:
>> &&
>> && >open (FH , $old_fichier);
>> && >select(FH);
>> && >rename $new_fichier, $old_fichier;
>> && >`cp $new_ficier /image1`
>> && >
>> && >its nice that
>> &&
>> && IMHO you want either to do it all in Perl or use OS native commands
>> && altogether. Personally, I would perfer the former.
>>
>>
>> I very much prefer the latter.
>>
>>
>>
>> Abigail

> why

I do not know how I will program the change image to order. on sale

Joe Smith 02-27-2007 07:55 AM

Re: problem cp
 
Abigail wrote:

> use File::Copy;
> copy $file => $destination;
>
> needs two lines just to copy one file, is broken, is hopelessly inflexible,
> and will delete your files if you think 'copy' might mimic the 'cp' command.


Huh? Just how can copy() cause the input file to be deleted?

-Joe


All times are GMT. The time now is 12:18 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.