Skip to contentSkip to conversation

rename() a directory over a symlink

DISCUSSION Timo Sirainen 2 participants 2 messages Aug 3, 2009 – Aug 4, 2009

lore
Share & tools
lore
#0 lore raw

Is there a reason why it's not allowed? Would it be difficult to implement it? Seems like it shouldn't be much different from renaming a file over a symlink.

#1 lore raw
Quoted 3 lines · you

Is there a reason why it's not allowed? Would it be difficult to implement it? Seems like it shouldn't be much different from renaming a file over a symlink.

It's in the standard we are following,
http://www.opengroup.org/onlinepubs/009695399/functions/rename.html:

"If the old argument points to the pathname of a directory, the new argument shall
not point to the pathname of a file that is not a directory."

http://www.opengroup.org/onlinepubs/009695399/utilities/mv.html:

"In the second synopsis form, mv shall move each file named by a source_file
operand to a destination file in the existing directory named by the target_dir operand, or referenced if target_dir is a symbolic link referring to an existing directory. The destination path for each source_file shall be the concatenation of the target directory, a single slash character, and the last pathname component of the source_file. This second form is assumed when the final operand names an existing directory."

	Arnd <><