Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: mv'ing files from a C program Message-ID: <4525@auspex.auspex.com> Date: 25 Nov 90 22:27:52 GMT References: <1990Nov15.183359.963@ssd.kodak.com> <1990Nov16.231909.20173@virtech.uucp> <1990Nov21.061700.20005@mercury.cair.du.edu> Distribution: na Organization: Auspex Systems, Santa Clara Lines: 20 >Isn't invoking a shell a bit much to mv a file when you can >link(2)/unlink(2)? In this particular case, it probably is. The original poster seemed to be indicating that they wanted to move a file (i.e., not a directory), and may have wanted to move it to another directory on the same file system. If they'd wanted to move a directory, then unless their system had "rename(2)" (in which case, using "link(2)" and "unlink(2)" is a bit much) or their program was running as super-user, they'd almost certainly have to run "mv", as most UNIX systems disallow anybody but the super-user from linking to or unlinking from a directory. (And even if it *is* running as super-user, I'd still be tempted to run "mv" anyway, as there's more than just a simple "link()/"unlink()" pair involved in moving a directory.) Also, if they wanted to move it to another file system, running "mv" may be more convenient than duplicating "mv"s "try to move it with 'remove()' or 'link()/unlink()' and, if you get EXDEV, copy it" action.