GNU bug report logs -
#14564
A confusing problem about 'mv'
Previous Next
Reported by: Je Li <jerryli8664 <at> gmail.com>
Date: Thu, 6 Jun 2013 06:57:01 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 2013-06-07 at 00:38:36 +0100, P <at> draigBrady.com 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
This bug report was last modified 11 years and 352 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.