Re: how copy file on linux?

Liste des GroupesRevenir à cu programmer 
Sujet : Re: how copy file on linux?
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.programmer
Date : 27. Jun 2024, 07:05:20
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v5ivf2$2jv6s$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 27.06.2024 02:40, Thiago Adams wrote:
Em 6/26/2024 8:24 PM, Lew Pitcher escreveu:
(Followup set to comp.unix.programmer)
>
On Wed, 26 Jun 2024 15:35:00 -0700, Keith Thompson wrote:
>
Thiago Adams <thiago.adams@gmail.com> writes:
How to copy a file on linux keeping the original file information?
timestamp etc?
>
Or in other words the equivalent of CopyFileA from windows.
>
comp.unix.programmer is likely to give you better answers.  I don't
think POSIX defines any functions that copy files.
>
No, AFAIK, POSIX doesn't define an "all-in-one" file copy function.
However, Linux (the OS Thiago asks about) defines a number of them.
>
If I uunderstand correctly, you want to do the equivalent of "cp -p",
>
Which /can/ be accomplished with POSIX calls
   - the standard I/O functions (fopen()/open(), fread()/read(),
     fwrite()/write(), fclose()/close() ) to copy the file data
   - stat() to obtain the "original file information", and
   - utime() to set the copy timestamps,
   - chmod() to set the copy file permissions
   - chown() to set the file ownership
>
But, perhaps Thiago would be satisfied with just a hardlinked file.
>
but from C rather than from a shell.  You might consider using system(),
but that has some drawbacks, and there are probably better ways.
>
>
 
I am using this to create a "deploy" folder with all files necessary to
run a program. So on windows I am coping dlls and I think it is a good
idea to keep the original file attributes . (I am not sure if zip files
keep that.. I need to check)
 
On linux I may need to copy some files and I think is is a good idea to
keep the original attributes as well.

This sounds like you want some shell command line tool or shell script.

IME, to "deploy" a package I have an own directory structure. So 'cp -p'
is the key command (or 'cp -a' if you also have whole directories to be
copied with all contents); this will preserve attributes on the file
system. To preserve them in the bundled package I use the 'tar' command
(that also preserves attributes, as far as possible); e.g. 'tar cvzf'
(see man page for details on options).

Janis


Date Sujet#  Auteur
27 Jun 24 * Re: how copy file on linux?5Thiago Adams
27 Jun 24 +- Re: how copy file on linux?1Kaz Kylheku
27 Jun 24 +- Re: how copy file on linux?1Paul
27 Jun 24 +- Re: how copy file on linux?1Janis Papanagnou
27 Jun 24 `- Re: how copy file on linux?1candycanearter07

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal