[comp.binaries.ibm.pc.d] picnix3 mv

feg@clyde.ATT.COM (Forrest Gehrke) (06/08/88)

The corrected mv command with picnix3 still has a
small problem:  If you should happen to request a
move of a file to a non-existent directory, it
"moves" it and deletes it from the source
directory---all silently.  

I did this accidentally, misspelling the name of
an existent directory.  The file disappeared.

BTW, the MKS mv command does the same trick.

    Forrest Gehrke

boneill@hawk.ulowell.edu (SoftXc Coordinator) (06/08/88)

In article <27734@clyde.ATT.COM> feg@clyde.ATT.COM (Forrest Gehrke) writes:
>The corrected mv command with picnix3 still has a
>small problem:  If you should happen to request a
>move of a file to a non-existent directory, it
>"moves" it and deletes it from the source
>directory---all silently.  
>
>I did this accidentally, misspelling the name of
>an existent directory.  The file disappeared.
>

I was unable to recreate this problem. When you give the command 'mv name1
name2', it checks for the existence of name2. If it does not exist, name1 is
renamed to name2. If it does exist, and it is a directory, the file is given
the name name2\name1. When you mispelled the name of the directory, it
should have created a file with the name you typed. If you gave a complete
pathname, and mispelled one of the subdirectories, MV would have given you a
'CANNOT CREATE error'.

============================================================================
Brian O'Neill, MS-DOS Software Exchange Coordinator
ArpaNet: boneill@hawk.ulowell.edu 
UUCP   : {(backbones),harvard,rutgers,et. al.}!ulowell!hawk!boneill

feg@clyde.ATT.COM (Forrest Gehrke) (06/10/88)

In article <7449@swan.ulowell.edu>, boneill@hawk.ulowell.edu (SoftXc Coordinator) writes:
> In article <27734@clyde.ATT.COM> feg@clyde.ATT.COM (Forrest Gehrke) writes:
> >The corrected mv command with picnix3 still has a
> >small problem:  If you should happen to request a
> >move of a file to a non-existent directory, it
> >"moves" it and deletes it from the source
> >directory---all silently.  
> >
> >I did this accidentally, misspelling the name of
> >an existent directory.  The file disappeared.
> >
> 
> I was unable to recreate this problem. When you give the command 'mv name1
> name2', it checks for the existence of name2. If it does not exist, name1 is
> renamed to name2. If it does exist, and it is a directory, the file is given
> the name name2\name1. When you mispelled the name of the directory, it
> should have created a file with the name you typed. If you gave a complete
> pathname, and mispelled one of the subdirectories, MV would have given you a
> 'CANNOT CREATE error'.

This is true but ONLY if (as you say) you provided a COMPLETE pathname:

    mv name1 /boguspath/<filename>

If a destination filename is NOT provided on the command 
line for the case of a non-existent destination directory, 
the "cannot create" message is not displayed.

The command silently treats the last directory name as the
destination filename (ignoring an ending backslash) and 
the file is moved to the directory appearing next.  If that
is the backslash, then it appears in the root directory.
(I was wrong about the file disappearing).

This is not exactly Unix-like, which only requires the
directory path if the filename is not to be changed. 


   Forrest Gehrke

toma@tekgvs.TEK.COM (Tom Almy) (06/10/88)

In article <7449@swan.ulowell.edu> boneill@hawk.ulowell.edu (SoftXc Coordinator) writes:
>In article <27734@clyde.ATT.COM> feg@clyde.ATT.COM (Forrest Gehrke) writes:
>>[...] If you should happen to request a
>>move of a file to a non-existent directory, it
>>"moves" it and deletes it from the source
>>directory---all silently.  
>
>I was unable to recreate this problem. 

Well, I was able.  I  don't use PICNIX mv (I use a MetaWare version), but I
tried it with PICNIX cp, the new "corrected" version:

cp file \foo\bar

where directory \foo does not exist, causes a copy of the file to be made in
the *current* directory, called "foobar".  Not too nice.

Tom Almy
toma@tekgvs.TEK.COM

rivers@xyzzy.UUCP (Dave Rivers) (06/14/88)

In article <3563@tekgvs.TEK.COM> toma@tekgvs.UUCP (Tom Almy) writes:
>In article <7449@swan.ulowell.edu> boneill@hawk.ulowell.edu (SoftXc Coordinator) writes:
>>In article <27734@clyde.ATT.COM> feg@clyde.ATT.COM (Forrest Gehrke) writes:
>>>[...] If you should happen to request a
>>>move of a file to a non-existent directory, it
>>>"moves" it and deletes it from the source
>>>directory---all silently.  
>>
>>I was unable to recreate this problem. 
>
>Well, I was able.  I  don't use PICNIX mv (I use a MetaWare version), but I
>tried it with PICNIX cp, the new "corrected" version:
>
>cp file \foo\bar
>
>where directory \foo does not exist, causes a copy of the file to be made in
>the *current* directory, called "foobar".  Not too nice.
>
>Tom Almy
>toma@tekgvs.TEK.COM
>

If you have set the swithchar to a forward slash (ala UNIX) then, as per
unix definitions, the backslash becomes the escape char, not the escape
key on your keyboard, but rather a character which indicates that the next
character is to be taken literally.  Certain characters following the backslash
have particular meanings - for example \n indicates new-line (as with 'C').
If the character is not one of those signalled out, the backslash has no effect,
and is simply "removed" from the line. (If I may be so loose in my description)
So, your command:

    cp file \foo\bar

  becomes
 
    cp file foobar
  
  since \f and \b mean nothing.

If you really wanted to try out the copy, do it this way:

    cp file /foo/bar


	- Dave Rivers


-- 
+----------------------------------------------------------------------+
| Time Sharing is the use of     | Dave Rivers:                        |
|  many people by the computer.  |  UUCP {Backbones}!rti!dg-rtp!rivers |
|                                |  Phone: (919) 248-6137              |
+----------------------------------------------------------------------+