Giter Club home page Giter Club logo

Comments (10)

kegesch avatar kegesch commented on June 16, 2024

I will start with this.

from coreutils.

GrayJack avatar GrayJack commented on June 16, 2024

Nice, have fun 😄

from coreutils.

kegesch avatar kegesch commented on June 16, 2024

@GrayJack i ran into a problem here. Maybe you know how to solve it. cp -p -R symlink should copy a symlink and preserve its metadata. But apparently there is no way in Rust to copy a symlink. You can only create one. But also you can not set a file's metadata, at least i could not find any way to do so. Do you have an idea?

from coreutils.

GrayJack avatar GrayJack commented on June 16, 2024

I have to look into that, never done it

from coreutils.

GrayJack avatar GrayJack commented on June 16, 2024

How do you preserve the metadata on the other types of file?

from coreutils.

kegesch avatar kegesch commented on June 16, 2024

fs::copy() copies a file with metadata. And to not preserve it i use io::copy(). For dirs i have the same problem as with symlinks. There is a function in fs to set permissions but i found nothing about modified, creation date etc.

from coreutils.

GrayJack avatar GrayJack commented on June 16, 2024

Did you found out any more info on how to do this?

from coreutils.

GrayJack avatar GrayJack commented on June 16, 2024

Aha!!! Found it, to preserve attributes of a link you have to hardlink the files

So, if you want to copy a symlink, you have to hardlink the link to another path, and hardlink will preserve the attributes

fs::hard_link() function does that

from coreutils.

kegesch avatar kegesch commented on June 16, 2024

Yes, but a hardlink is not a symlink if i understood correctly.

from coreutils.

GrayJack avatar GrayJack commented on June 16, 2024

Yes, but all code that I saw (FreeBSD, NetBSD and uutils) does that when preserving a copy a symlink preserving metadata

from coreutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.