problem cp

J

john.swilting

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
 
J

john.swilting

john.swilting said:
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
 
J

john.swilting

john.swilting said:
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
 
J

john.swilting

john.swilting said:
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
 
J

john.swilting

Michele said:
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
 
J

john.swilting

Abigail said:
Michele Dondi ([email protected]) wrote on MMMMCMXXIV September
MCMXCIII in <URL:&& On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
&&
&& >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
 
J

Joe Smith

Abigail said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top