armhold@topaz.rutgers.edu (George Armhold) (08/27/89)
I'm working on a "mv" program. I'd like it to be smart enough to simply rename files/directories if they are on the same volume, rather than copying them. The rename function provided by Lattice (which is supposed to be ANSI) will not allow me to specify a path name in the new file. The manual states: "The old name can include a path, but the new name should not." This seems likes a rather odd restriction. Are file systems (especially AmigaDOS) built in such a way that renaming a file to a new directory presents a problem? The function also seems to fail when I try to rename a directory. Am I missing something? Is there a better way to do this? Thanks, -George armhold@topaz.rutgers.edu
usenet@cps3xx.UUCP (Usenet file owner) (08/28/89)
In article <Aug.26.22.24.20.1989.10338@topaz.rutgers.edu> armhold@topaz.rutgers.edu (George Armhold) writes: > >I'm working on a "mv" program. I'd like it to be smart enough to >renaming a file to a new directory presents a problem? The function >also seems to fail when I try to rename a directory. Am I missing ^^^^^^^^^^^^^^^^^^ I don't know what ANSI says about this, but MessyDos has problems with renameing directories. I don't know why. I suggest that you use AmigaDOS directly. It will make your program smaller, faster, and non-portable, but would do the job better. The problem with using ANSI functions instead of the native OS functions is that they have only a subset of the functionality of the OS functions. The advantage to using the ANSI functions is portablility, or course. The AmigaDOS Rename function takes a source path and a destination path. If you try the rename accross devices, it will fail and IoErr() will return the "Cant rename across devices" error. REAL NAME: Joe Porkka jap@frith.cl.msu.edu