Subject: bug#14564: A confusing problem about 'mv'

From: Rob Wortman <[email-masked]>
Date: Thu, 6 Jun 2013 16:56:10 -0700

On 2013-06-07 at 00:38:36 +0100, [email-masked] wrote:
> On 06/06/2013 07:52 AM, Je Li wrote:
> > Today I just used a command as below:
> > 
> > $ mv win_* *
> > 
> > and got an unexpected result.
> > 
> > Of course I had some folders named with 'win_*' under current
> > directory, such as 'win_core'. After the command is done, I can not
> > find these folders anywhere in the file system.
> > 
> > It is a bit confusing, the destination does not seem valid
> > apparently but the command is executed without any warnings, and
> > unluckily, my files are gone.
> > 
> > My OS: Ubuntu 13.04
> 
> Unfortunately coreutils can't do anything here as the shell
> is interpreting the command line and just passing the resultant
> file list to mv.
> 
> Note the last param to mv is generally a single
> directory and so '*' would be incorrect,
> even if suitably quoted to avoid shell globbing.

To expand a bit, Je Li, your files are probably not gone. You very
probably got an error message very much like

	mv: cannot move `foo' to a subdirectory of itself, `foo/foo'

where "foo" is one of your directories. That directory is probably still
there and everything else is probably inside it. For what you wanted to
do, you will want to familiarize yourself with the `rename` command on
your system. There are several variants about, so consult your local
manpage.

-- 
The way to make incompetent individuals realize
their own incompetence is to make them competent.
  -- Kruger and Dunning