Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to preserve mtime on move action #263

Closed
FlorianMittag opened this issue Dec 25, 2022 · 1 comment
Closed

Add option to preserve mtime on move action #263

FlorianMittag opened this issue Dec 25, 2022 · 1 comment

Comments

@FlorianMittag
Copy link

Is your feature request related to a problem? Please describe.
When I move files, I want the file creation and modified time to be preserved. Currently there is no option to do that.

Describe the solution you'd like
I want to be able to specify that a move action should preserve the modified time on files

Describe alternatives you've considered
There are none

Additional context
The code is already in place to preserve the mtime on file move, but it is off by default and there is no way to enable it via config.yaml.
(See organize/actions/move.py)

# this is taken from my PR
def move_file_optimized(
    src_fs,
    src_path,
    dst_fs,
    dst_path,
    preserve_time=False,
    cleanup_dst_on_error=True,
):
    # type: (...) -> None
    """Move a file from one filesystem to another.
    Arguments:
        src_fs (FS or str): Source filesystem (instance or URL).
        src_path (str): Path to a file on ``src_fs``.
        dst_fs (FS or str): Destination filesystem (instance or URL).
        dst_path (str): Path to a file on ``dst_fs``.
        preserve_time (bool): If `True`, try to preserve mtime of the
            resources (defaults to `False`).
        cleanup_dst_on_error (bool): If `True`, tries to delete the file copied to
            ``dst_fs`` if deleting the file from ``src_fs`` fails (defaults to `True`).
@tfeldmann
Copy link
Owner

Thanks for reporting! This is fixed in the latest v3 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants