469,934 Members | 1,743 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

Kepping Directory Permissions

I'm working on a program that takes files by path and moves them into
new locations, and then back again if the user intends. Everything is
great so far except I cannot figure out how to keep directory
permissions. File permissions are no problem, but when I try and put
a directory's permissions back, I, the user, lose all access to that
directory. When I give myself permission again, all my files have
kept their permissions. Here are some functions I am working with:

I have a File object that keeps the files original path, its new path
and permissions. When an instance is made of this object, it uses:
dirPath = os.path.dirname(filePath) to get the the files parent
directory. I get the directories permissions with this data calling
os.stat(dirPath)[0] and saving this value into an integer essentially.
When it comes time to move the file, I use os.renames() to put the
file into its new location, copy its permission's over and copy its
directories permissions over. It works for the file, but not for the
directories. Any ideas on how to save a directories permissions when
moved using renames()? Thank you.

-Tracy Tripp
Jul 18 '05 #1
0 1333

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by bonehead | last post: by
reply views Thread by Jeff Reed | last post: by
3 posts views Thread by James Coleman | last post: by
8 posts views Thread by theWizard1 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.