[UFO Chicago] very newbie 'nix question

Sean Neakums sneakums@ufo.chicago.il.us
Sat, 26 Jan 2002 21:31:49 +0000


begin  John Kilbourne quotation:

> Now that I've met you guys and feel comfortable, I can reveal the 
> depths of my true ignorance. I want to move a directory full of files 
> from one place to another. My reading of man mv tells me it only 
> operates on files. How do I move a directory; the files don't have a 
> suffix or other common element in the name.

In Unix, directories are simply files whose contents are given special
meaning by the kernel, so mv should work fine.  GNU mv will also
handle the case where the source and destination are on different
filesystems, but other Unices may not so graceful.

The reason mv works identically on both files and directories is that
directories are in fact files.  So all that mv has to do for either
case is delete one directory entry, and create a new one.  This is
done under the hood using the rename(2) system call, except in the
aforementioned filesystem-crossing case.

-- 
Sean Neakums - <sneakums@ufo.chicago.il.us> --- --- -- -
Director of International Operations, UFO Chicago - -- -
http://ufo.chicago.il.us/ --- ------ ----- ---- --- -- -