Kepping Directory Permissions

Discussion in 'Python' started by Tracy Tripp, Nov 7, 2003.

  1. Tracy Tripp

    Tracy Tripp Guest

    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
     
    Tracy Tripp, Nov 7, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roberto López
    Replies:
    0
    Views:
    310
    Roberto López
    Jul 22, 2003
  2. Mark MacRae

    bin Directory has no Execute permissions

    Mark MacRae, Sep 19, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    522
    Brian Henry
    Sep 19, 2003
  3. Scott Allen
    Replies:
    0
    Views:
    440
    Scott Allen
    Jul 13, 2004
  4. carla

    directory permissions question

    carla, Apr 1, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    328
    carla
    Apr 1, 2005
  5. Curt K
    Replies:
    0
    Views:
    566
    Curt K
    Nov 3, 2006
Loading...

Share This Page