[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mv deletes files even if parameter not specified.

From: Bob Proulx
Subject: Re: mv deletes files even if parameter not specified.
Date: Wed, 18 Sep 2002 23:34:40 -0600
User-agent: Mutt/1.4i

John Miles <address@hidden> [2002-09-18 12:05:38 -0700]:

Thanks for the report.  But I did not understand it.  Please clarify.

> address@hidden:~/ftpd/ftpd/site/projects/drive3/senior_design# mv 
> ../../drive1/uploads/Bers*
> notice that the mv does not have the second parameter of the destination.  
> I omitted this purposly... doing this will delete the first file it finds 
> that matches Bers*

Using '*' wildcards makes this ambiguous unless you also say what
files are in the directory.  Please say what 'echo Bers*' reports.
Otherwise it is not possible to know exactly what arguments the mv
command is seeing.  The shell expands wildcards before commands see
them and then pass the expanded arguments to the program.

For example, one file:

  touch Bers1
  echo mv Bers*
  mv Bers1
  mv: missing file argument

For example, two files:

  touch Bers1 Bers2
  echo mv Bers*
  mv Bers1 Bers2

That will remove Bers1 and move it to Bers2.

For example, three files:

  touch Bers1 Bers2 Bers3
  echo mv Bers*
  mv Bers1 Bers2 Bers3
  mv: when moving multiple files, last argument must be a directory

What version of mv are you using?

  mv --version


> note however, this is repeatable only if I'm using relative "../../" paths 
> several directories in.
> typing the same thing but in the directory of the location of the file 
> produces the correct result:
> address@hidden:~/ftpd/ftpd/site/projects/drive1/uploads# mv Bers*
> mv: missing file argument
> Try `mv --help' for more information.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]