Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > problem cp

Reply
Thread Tools

problem cp

 
 
john.swilting
Guest
Posts: n/a
 
      02-23-2007
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
 
Reply With Quote
 
 
 
 
john.swilting
Guest
Posts: n/a
 
      02-23-2007
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
 
Reply With Quote
 
 
 
 
john.swilting
Guest
Posts: n/a
 
      02-23-2007
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
 
Reply With Quote
 
john.swilting
Guest
Posts: n/a
 
      02-23-2007
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
 
Reply With Quote
 
john.swilting
Guest
Posts: n/a
 
      02-23-2007
Michele Dondi wrote:

> On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
> <(E-Mail Removed)> 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
 
Reply With Quote
 
john.swilting
Guest
Posts: n/a
 
      02-23-2007
Abigail wrote:

> Michele Dondi ((E-Mail Removed)) wrote on MMMMCMXXIV September
> MCMXCIII in <URL:news:(E-Mail Removed) om>:
> && On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
> && <(E-Mail Removed)> 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
 
Reply With Quote
 
john.swilting
Guest
Posts: n/a
 
      02-23-2007
john.swilting wrote:

> Abigail wrote:
>
>> Michele Dondi ((E-Mail Removed)) wrote on MMMMCMXXIV September
>> MCMXCIII in <URL:news:(E-Mail Removed) om>:
>> && On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
>> && <(E-Mail Removed)> 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
 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      02-27-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments