mv --reply=
am 03.04.2008 05:25:18 von Allodoxaphobia
I've never had the occasion to use "--reply=[yes|no|query]" with `mv`
before this. It looked like a good solution for me in a recent task, so
it tried it.
Snafu!
I had a large directory of mp3's and a smaller directory of mp3's --- _some_
of which were duplicates (by filename) of files in the larger directory.
I wanted to move the non-dupes (only) into the larger directory.
From inside the smaller directory:
$ mv --reply=no *.mp3 ../LargeDirectory/
I was left with no files in the smaller directory and, indeed, _all_ of
the files were moved -- with the duplicates overwriting the files in the
larger directory.
I did some testing.
That's the way it's working here. `mv --reply=no` seems to act as if I
was replying "yes".
I have `alias mv="mv -i"` set in my .bashrc, so I also did tests with
$ /bin/mv --reply=no .........
Same results.
`man mv` states:
--reply={yes,no,query}
specify how to handle the prompt about an existing
destination file
At www.gnu.org/software/coreutils/manual/html_node/mv-invocatio n.html, I
find this on the "--reply" option:
*Deprecated: to be removed in 2008.*
OK .......... but this happened on Mandrake 10.2, aka MDK LE2005.
What am I doing wrong?
Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
*** Killfiling google posts:
Re: mv --reply=
am 03.04.2008 10:11:39 von PK
Allodoxaphobia wrote:
> What am I doing wrong?
First, --reply is a GNU-only, non-standard option and should be avoided if
possible.
Now let's look at what the info page for mv says about --reply:
Note that `--reply=no' has an effect only when `mv' would prompt
without `-i' or equivalent, i.e., when a destination file exists and is
not writable, standard input is a terminal, and no `-f' (or equivalent)
option is specified.
Does this make sense for your case?
--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
Re: mv --reply=
am 04.04.2008 17:02:47 von Allodoxaphobia
On Thu, 03 Apr 2008 10:11:39 +0200, pk wrote:
> Allodoxaphobia wrote:
>
>> What am I doing wrong?
>
> First, --reply is a GNU-only, non-standard option and should be avoided if
> possible.
>
> Now let's look at what the info page for mv says about --reply:
>
> Note that `--reply=no' has an effect only when `mv' would prompt
> without `-i' or equivalent, i.e., when a destination file exists and is
> not writable, standard input is a terminal, and no `-f' (or equivalent)
> option is specified.
>
> Does this make sense for your case?
Well, that sentence makes my head hurt. But, chewing on it long enough
I can make it reason out that --reply= is of no use in my case.
However, if it "has no effect" (in my case), it seems egregious that
`mv` runs as if I was replying "y" to every overwrite case.
Even worse, my mv man:
$ man mv
:
:
-i, --interactive
prompt before overwrite (equivalent to --reply=query)
--reply={yes,no,query}
specify how to handle the prompt about an existing
destination file
--strip-trailing-slashes remove any trailing slashes from each
SOURCE argument
:
:
I'm glad I didn't first use this useless option on something like /lib/
or the somesuch!
Thanks,
Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
*** Killfiling google posts:
Re: mv --reply=
am 04.04.2008 18:52:02 von PK
Allodoxaphobia wrote:
> I'm glad I didn't first use this useless option on something like /lib/
> or the somesuch!
If you absolutely need that behavior, you can probably use the "yes" program
to put together a kludge like eg
yes n | mv -i .....
This way it will read "n" from stdin each time it needs to get an answer.
If you're ever going to use that, test it on unimportant files or
directories before.
--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.