Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mkdir and mkfile

501 views
Skip to first unread message

Masood Sayam

unread,
Nov 17, 2002, 3:55:04 PM11/17/02
to
Hello all,

Question:

If one types something like "mkdir a/include/the" in the root directory
and the directory "a" does not exist yet, should our mkdir function create
all three directories? That is, create "a" in "/", "include" in "a", and
"the" in "include" ?

or...does the directory "a" have to exist in order for the command to be
valid?

And, similarly, if one invokes mkfile in the root directory as: "mkfile
a/include/the", should our mkfile function create a directory called "a",
make another directory called "include" inside "a" and then make a file
called "the" inside include?

Any help would be appreciated.

Thanks

Siddiqui Mohammed

unread,
Nov 17, 2002, 7:23:23 PM11/17/02
to Masood Sayam
Hi,

If the directory does not exist then it has to be created. For
example, if the user types "mkdir /a/include" and directory "a" does not
exist, then directory "a" has to be created and directory "include" should
be placed within directory "a". As far as I believe there is no way to
create a directory using mkfile. Hope that helps.

Mohammed

He Da

unread,
Nov 17, 2002, 9:20:55 PM11/17/02
to
I thought that if an intermediate directory doesn't exist, then you cannot
create the directory at all. At least this is how unix and dos work.

Masood Sayam

unread,
Nov 17, 2002, 9:36:46 PM11/17/02
to

Actually, in dos, if you type something like "mkdir a\b\include" where
directory "a" does not exist, dos will create all three directories. ie:/
"include" in "b" and "b" in "a".

But...what about mkfile? Right now, I've set my mkfile so that it only
allows the user to create files in existing directories. I think that
makes sense because the purpose of mkfile is to make files, not to make
directories.

What do others think?

Any feedback would be appreciated.

Thanks!

Chattopadhyay Ritwik

unread,
Nov 17, 2002, 10:27:48 PM11/17/02
to
Hi there,

I thought we were building our file structure according to unix and that
if you type a\bin and a does not exist then you can't create and you get
an error message, And I also agree with Masood, mkfile is only for
creating files not directories, just like in unix
Can a TA please verify this. Thanks

Ritwik

Ho Yu Yeung

unread,
Nov 17, 2002, 10:37:27 PM11/17/02
to
um... I think I have asked the same thing on this board before. I think
the answer was that the mkdir mkfile only create the file/dir only if the
path already exist. i.e. the unix way, not the dos way.

Kenny

Wai Shun Ming Simon

unread,
Nov 18, 2002, 3:23:02 AM11/18/02
to
Currently both of my mkdir and mkfile will create intermediate directories
if they don't exist. I think this behaviour matches the handout
description "the new file will be placed in the location described by the
path." So I'm just trying to meet this requirement as long as it's
technically possible (i.e. intermediate name is not already used by a
file, in this case a directory with the same name cannot be created.)

Names like "ls" and "pwd" do kinda suggest a unix-like system, but
I don't really want to assume anything since it isn't explicitly stated in
the handout.

This is something a TA or prof should definitely clarify.

Ah Lot Charles Chan

unread,
Nov 18, 2002, 9:08:55 AM11/18/02
to Masood Sayam
Hi all,

You can assume that only one new element (file or directory) will be
created in one command, if more than one, just output error message.

On
Sun, 17 Nov 2002, Masood Sayam wrote:

0 new messages