bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mkdir when target exists and is a broken symlink


From: Avis, Ed
Subject: mkdir when target exists and is a broken symlink
Date: Mon, 16 May 2005 13:49:06 +0100

I'd like to suggest a possible new feature for mkdir and see what people
think of it.

% ln -s nonexistent foo
% mkdir foo
mkdir: cannot create directory `foo': File exists

There could be some kind of -f, --follow option so that mkdir will
create the directory pointed to.  You'd probably use it together with
-p.  Then 'mkdir -fp' would be a way to try everything sensible to make
sure the destination exists and can be used as a directory (ie, is a
directory itself or a symlink to one).

Is this a sensible thing to put in mkdir or is there some existing Unix
idiom that does what I want?

I note that 'touch foo' when foo is a broken symlink will create the
link destination if possible (though without making any directories,
obviously).  Whether this is an argument for or against the new flag to
mkdir I am not sure.

-- 
Ed Avis <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]