Check if file exists and ask before fetching, when copying

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Check if file exists and ask before fetching, when copying

積丹尼 Dan Jacobson
When we attempt to copy a file, but the target exists already, we still see
Fetching....
Overwrite...?

Wouldn't it be better to (do the check and) ask the question before fetching?
That way big files wouldn't be hauled over the cables, only to end up
not being needed, because the user has changed his mind.

[C runs the command dired-do-copy (found in dired-mode-map)]

tramp-version "2.4.2"

Reply | Threaded
Open this post in threaded view
|

Re: Check if file exists and ask before fetching, when copying

Michael Albinus
積丹尼 Dan Jacobson <[hidden email]> writes:

Hi Dan,

> When we attempt to copy a file, but the target exists already, we still see
> Fetching....
> Overwrite...?
>
> Wouldn't it be better to (do the check and) ask the question before fetching?
> That way big files wouldn't be hauled over the cables, only to end up
> not being needed, because the user has changed his mind.
>
> [C runs the command dired-do-copy (found in dired-mode-map)]

That isn't Tramp, but dired. Tramp implements `copy-file'. It always
checks first, whether the target file exists.

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Check if file exists and ask before fetching, when copying

積丹尼 Dan Jacobson
>>>>> "MA" == Michael Albinus <[hidden email]> writes:
MA> That isn't Tramp, but dired. Tramp implements `copy-file'. It always
MA> checks first, whether the target file exists.

OK but how about when copying files from the adb: device to the local
machine?

If the local file exists already, we shouldn't see any "Fetching" before
asking if we want to overwrite.

Or OK, this "fetching" is maybe composed of two phases, checking if the
file exists, then actually fetching it? So it would be better to show
more precise messages?

Reply | Threaded
Open this post in threaded view
|

Re: Check if file exists and ask before fetching, when copying

Michael Albinus
積丹尼 Dan Jacobson <[hidden email]> writes:

Hi Dan,

> MA> That isn't Tramp, but dired. Tramp implements `copy-file'. It always
> MA> checks first, whether the target file exists.
>
> OK but how about when copying files from the adb: device to the local
> machine?
>
> If the local file exists already, we shouldn't see any "Fetching" before
> asking if we want to overwrite.
>
> Or OK, this "fetching" is maybe composed of two phases, checking if the
> file exists, then actually fetching it? So it would be better to show
> more precise messages?

Honestly, you've lost me. I don't know what "Fetching" message you see
when.

Could you pls give me a short recipe, starting with "emacs -Q", showing
what you've typed and what are the results?

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Check if file exists and ask before fetching, when copying

積丹尼 Dan Jacobson
(Well here on Debian we use old emacs-version "26.3" so it is probably
not worth perusing further.)