Path: utzoo!utgpu!water!watmath!clyde!feg From: feg@clyde.ATT.COM (Forrest Gehrke) Newsgroups: comp.binaries.ibm.pc.d Subject: Re: picnix3 mv Keywords: To a non-existent directory---phooom! Message-ID: <27858@clyde.ATT.COM> Date: 9 Jun 88 18:12:58 GMT References: <27734@clyde.ATT.COM> <7449@swan.ulowell.edu> Organization: AT&T Bell Labs, Whippany NJ Lines: 39 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/ 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