home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.13 / text0014.txt < prev    next >
Encoding:
Internet Message Format  |  1988-04-18  |  1.6 KB

  1. From: jc@minya.UUCP (John Chambers)
  2.  
  3. [ This one got misplaced as I prepared to go to USENIX.
  4. I don't really understand the question, but if it's whether the
  5. rename function can be used to move directories, the answer is yes
  6. (although the user command is mv).  -mod ]
  7.  
  8.  
  9. > >No portable application needs "appropriate privileges" to move directories
  10. > >around; it can use "rename()".  The correct way to move anything under a POSIX
  11. > >implementation is to use "rename()", not "link()" and "unlink()".
  12. > The rename() call is sufficient for changing the name of a directory, ...
  13.  
  14. One thing I've wondered is whether the standard will require implementors
  15. to make things like rename("foo/bar/x","foo/x") work correctly.  This is
  16. a serious omission in a great many Unix releases.
  17.  
  18. It's not at all a hypothetical issue.  I've seen a lot of cases where
  19. a user (myself included) uses tar or cpio or some such to unpack a bunch
  20. of files, intending them to go into foo/bar, and ending up with them all 
  21. in foo/bar/bar.  The usual result is "rm -rf foo/bar/bar" and starting 
  22. over.  It'd save a lot of grief if one could just say something like:
  23.     rename foo/bar/bar foo/temp
  24.     rename foo/temp foo/bar
  25. and be done with it.  Of course, it'd be better if I could just type:
  26.     rename foo/bar/bar foo/bar
  27. and get the desired result, but that's probably too much to hope for. ;-)
  28.  
  29. Given the history of Unix releases, I wouldn't expect this to work when 
  30. foo/bar/bar is a directory, unless there is some argument stronger than 
  31. users' needs to convince the implementors.
  32.  
  33. -- 
  34. John Chambers <{adelie,ima,maynard,mit-eddie}!minya!{jc,root}> (617/484-6393)
  35.  
  36.  
  37. Volume-Number: Volume 13, Number 16
  38.  
  39.