Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default File::Copy

    Anyone know how to get File::Copy module to keep file permissions when
    it copies from one location to another?

    Thanks

    Larry Guest Guest

  2. Similar Questions and Discussions

    1. i m using asp to copy a file but its not copied
      hi i m using scripting.filesystemobject to copy a file from server directory with another name, but i m not able to do it whenever i call that...
    2. copy file
      Hello all I like to move a uploaded file but I get the warning I do not have the right priviliges I tried to change this with the ftp_site...
    3. copy only the pm file?
      Can i say that is an installation For example, i didn;t have the Tk::Columns so i download the pm file(source) and copied into the...
    4. File::Copy & CGI.pm
      From: "Yupapa.com" <webmaster@yupapa.com> This aint entirely true. You can use File::Copy to copy files to remote shares (Windows Networking),...
    5. File copy
      How can I copy a file from disk to server? Give me an example
  3. #2

    Default Re: File::Copy

    Larry Guest wrote:
    > Anyone know how to get File::Copy module to keep file permissions when
    > it copies from one location to another?
    >
    > Thanks
    >
    >

    "File::Copy also provides the "syscopy" routine, which copies the file
    specified in the first parameter to the file specified in the second
    parameter, preserving OS-specific attributes and file structure. For
    Unix systems, this is equivalent to the simple "copy" routine, which
    doesn’t preserve OS-specific attributes."

    I suspect that means it can't... but wrapping it in your own routine
    using 'stat' and 'chmod' to reset the permissions should be sufficient.

    perldoc -f stat
    perldoc -f chmod

    Be sure to catch the part in the stat page about masking off the
    filetype....

    [url]http://danconia.org[/url]
    Wiggins D'Anconia Guest

  4. #3

    Default RE: File::Copy


    Of course if it is using a system copy and you are using
    NT/2000/XP/2003, then standard rules apply, i.e. copying from one device
    to another won't necessarily copy the permissions, etc.

    -----Original Message-----
    From: Wagner, David --- Senior Programmer Analyst --- WGO
    [mailto:David.Wagner@freight.fedex.com]
    Sent: Tuesday, January 20, 2004 4:46 PM
    To: [email]larry@opsource.net[/email]; [email]beginners@perl.org[/email]
    Subject: RE: File::Copy

    ------------->SNIP<------------------

    So if you are on any of the three systems above andyou are NOT
    doing file handles, then the files should have the same file
    permissions. If you are on something else, then someone on the list may
    have what you need.

    Wags ;)

    Tim Johnson Guest

  5. #4

    Default Re: File::Copy

    On Jan 21, zentara said:
    >copy( "$ARGV[0]", "$ARGV[0]\.bak" );
    >chmod ($mode, "$ARGV[0]\.bak");
    >print "Backup completed.\n";
    Why do you backslash the . in "$ARGV[0]\.bak" but not in "completed.\n"?

    Long story short, you don't need to \ the . in either case, and you don't
    need quotes around $ARGV[0] as the first argument to copy().

    copy($ARGV[0] => "$ARGV[0].bak");

    --
    Jeff "japhy" Pinyan [email]japhy@pobox.com[/email] [url]http://www.pobox.com/~japhy/[/url]
    RPI Acacia brother #734 [url]http://www.perlmonks.org/[/url] [url]http://www.cpan.org/[/url]
    <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
    [ I'm looking for programming work. If you like my work, let me know. ]

    Jeff 'Japhy' Pinyan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139