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

Creating directories

5 views
Skip to first unread message

srinivasan srinivas

unread,
Sep 5, 2008, 1:44:04 AM9/5/08
to pytho...@python.org
Can someone tell me is there any module available to create directories??

I tried os, tempfile.
I was facing some issues with os.mkdir(). The mode setting was not proper with this method.

I created the directory 'stdin' with '0700' mode using os.mkdir() method.
$> ls -alR stdin/
stdin/:
total 12
drwx--S---   2 munisams munisams 4096 Sep  3 02:00 .
What is that 'S' in the group permission field??

Thanks,
Srini

Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/

david wright

unread,
Sep 5, 2008, 3:21:34 AM9/5/08
to srinivasan srinivas, pytho...@python.org
--- On Fri, 9/5/08, srinivasan srinivas <sri_a...@yahoo.co.in> wrote:

> From: srinivasan srinivas <sri_a...@yahoo.co.in>
> Subject: Creating directories
> To: pytho...@python.org
> Date: Friday, September 5, 2008, 1:44 AM
> Can someone tell me is there any module available to create
> directories??
>
> I tried os, tempfile.
> I was facing some issues with os.mkdir(). The mode setting
> was not proper with this method.
>
> I created the directory 'stdin' with '0700'
> mode using os.mkdir() method.
> $> ls -alR stdin/
> stdin/:
> total 12
> drwx--S--- 2 munisams munisams 4096 Sep 3 02:00 .
> What is that 'S' in the group permission field??
>

this appears to be working, what where you expecting?

"An upper case "S" means there is no executable permission, but the set group id function is active- that is, a file in this directory will belong to the same group id as the directory itself."


If the parent directory has the set group id set, the child will as well.
i.e.
dwright@debian:~$ cd /tmp/
dwright@debian:/tmp$ mkdir test
dwright@debian:/tmp$ ls -ld test
drwxr-xr-x 2 dwright dwright 1024 2008-09-04 05:19 test
dwright@debian:/tmp$ ls -la test
drws------ 2 dwright dwright 1024 2008-09-04 05:19 .
drwxrwxrwt 13 root root 3072 2008-09-04 05:19 ..
dwright@debian:/tmp$ chmod 2700 test
dwright@debian:/tmp$ ls -la test
total 4
drwx--S--- 2 dwright dwright 1024 2008-09-04 05:19 .
drwxrwxrwt 13 root root 3072 2008-09-04 05:19 ..

dwright@debian:~$ python
Python 2.4.4
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.mkdir('/tmp/test/TEST', 0700)

dwright@debian:/tmp$ ls -la test
total 5
drwx--S--- 3 dwright dwright 1024 2008-09-04 05:20 .
drwxrwxrwt 13 root root 3072 2008-09-04 05:19 ..
drwx--S--- 2 dwright dwright 1024 2008-09-04 05:20 TEST

dwright@debian:/tmp$ ls -la test/TEST
total 2
drwx--S--- 2 dwright dwright 1024 2008-09-04 05:20 .
drwx--S--- 3 dwright dwright 1024 2008-09-04 05:20 ..

+David

0 new messages