problem cp

Discussion in 'Perl Misc' started by john.swilting, Feb 23, 2007.

  1. 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, Feb 23, 2007
    #1
    1. Advertising

  2. 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, Feb 23, 2007
    #2
    1. Advertising

  3. 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, Feb 23, 2007
    #3
  4. 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, Feb 23, 2007
    #4
  5. Michele Dondi wrote:

    > On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
    > <> 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, Feb 23, 2007
    #5
  6. Abigail wrote:

    > Michele Dondi () wrote on MMMMCMXXIV September
    > MCMXCIII in <URL:news:>:
    > && On Fri, 23 Feb 2007 12:54:05 +0100, "john.swilting"
    > && <> 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, Feb 23, 2007
    #6
  7. john.swilting wrote:

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

    Joe Smith Guest

    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
    Joe Smith, Feb 27, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    3,968
    Andreas Suurkuusk
    Jul 27, 2003
  2. Ted Miller
    Replies:
    0
    Views:
    5,147
    Ted Miller
    Sep 13, 2003
  3. Merek
    Replies:
    0
    Views:
    1,957
    Merek
    Dec 3, 2003
  4. Scott Meddows
    Replies:
    1
    Views:
    386
    John Saunders
    Jun 8, 2004
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    545
    Bullschmidt
    May 11, 2004
Loading...

Share This Page