Re: NEBIE Question on mv



On 2007-12-31, Samantha <samantha@xxxxxxxxxxx> wrote:

I just went ahead and typed the following command:

% mv science.bck ./backups

and that worked fine. It means move the file from the current directory
to the current directory (the period) plus the sub directory /backups.
I understand that.

Well looking at the tutorial, this is the answer they gave to execute
the move.

% mv science.bak backups/.

The period is pretty much meaningless - it is an entry in every
directory that references that directory itself. In both
../backups and backups/. it is redundant. Unless they begin with
a / to denote an absolute pathname pathnames are generally relative
to the current directory and so all path/filenames begin with an
implicit "./" .

An explicit "./backups" says "look at the current directory. Then
look at "." (the current directory again). Then look at backups
in that directory." Similarly "backups/." says "Look at the current
directory, then look at backups in that directory. Then look at
that directory again."

In other words it is nothing more than a waste of time in these
circumstances. It isn't even the whole story either, as "././backups"
and "backups/././" and even "./././././backups/./././././././" all
refer to the same place with various amounts of pointless looping
around.

Where does . come in useful? Primarily where you need to specify
a directory and in that particular instance the current directory
is the one you want. In something like "cp lots os different files ."
the . is required since in that context the last parameter must be
a directory, and . is a simple shorthand to specify the current
working directory. "." also has uses in protecting certain potentially
troublesome filenames from being interpreted in a special manner,
but that is a more advanced topic best not tackled right now.

The companion to . is .. which always refers to the parent of the
referenced directory, except in the root directory where it references
itself the same as ".". In your example above a straight .. would
refer to your home directory (which itself can usually be referred
to as "~", but the mechanism for that differs). A reference to
"backups/.." would refer to the parent of backups, i.e. the current
directory, the same as "." only less direct.

--
Andrew Smallshaw
andrews@xxxxxxxxxxxxxxxx
.



Relevant Pages

  • Re: Cannot change ReadOnly property for the expression column
    ... they do not refer to columns in parent tables that are themselves ... data bound controls/binding collections get confused and lose connection to ... I have seen some references to this problem as a known ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: All answers to C S Lewis
    ... > Do any of your above references refer specifically to the perihelion of ... and by Lydon and Sofia refer specifically to implications for Mercury's ... from the Sun, you can separate out the two. ... The other references I gave, ...
    (talk.origins)
  • Re: link chapter heading references
    ... For cross-references to an external document, you first need to bookmark the text you want to refer to in the source document. ... | [MVP - Microsoft Word] ... all the references will automatically change. ...
    (microsoft.public.mac.office.word)
  • Re: New thread time while youre all here - religious belief and mental health where are the line
    ... Though the former does refer to an Episcopalian ritual. ... As said upthread references to deconsecratin rituals having taken place can ... Such texts as I have on Church rituals don't have reference. ...
    (uk.religion.pagan)
  • Re: using a variable to create a new variable
    ... Symbolic references are forbidden under the "use strict" ... tures, particularly hashes. ... %main::) instead of a user-defined hash. ... use another scalar variable to refer to those by name. ...
    (perl.beginners)