Jump to content

File permissions backup


Recommended Posts

I'm trying to accomplish two things, outlined below. Keep in mind I'm a SysAdmin :D who uses scripting (VBScript and AutoIt) to automate daily tasks and complete major projects of repetitive tasks. I'm not a professional developer and don't have any of real development tools, such as Visual Studio. :mad:

The tasks at hand: :evil:

1. To get my company to officially approve AutoIt for use for scripting... major bureaucracy. I've covertly integrated AutoIt into our automation, but I'm hoping point 2 will help me acquire official approval by proving its worth on such a major assignment. :)

2. We are looking for a simple, quick way to backup ONLY file permissions, including extended permissions such as auditing and ownership. We simply need a way to restore an entire directory structure's permissions at a moment's notice and our backup solution wants to restore the entore files, plus the time it takes to load tapes, etc. There are commercial products available, but the cost is way too high and they all seem to want to do more than what we want.

So I've been searching for a way to use AutoIt to collect the file permissions from a directory structure and log them (file or database) for easy restore. I've also looked at VBScript, without success. I'm sure AutoIt itself doesn't support file permissions (wouldn't it be nice to have ownership/auditing as returned by FileGetAttrib, or have a new function like FileGetPermissions or FileGetExtAttrib?) :D, but if someone could point me in the direction of a utility that I could use AutoIt to automate, that would be extremely helpful.

I've thought of using RoboCopy (v XP010) because it can recreate a directory structure and zero-byte files and copy the source's permissions to those empty files. Robocopy doesn't appear to have a way to copy ONLY the permissions back to the original files though.

Any ideas?

rm

Link to comment
Share on other sites

I assume you're running an NT-based OS using NTFS. Try the command-line utility CACLS - I used that all the time in batch files to mass-modify permissions. If AutoIt doesn't have a native way to do it, this you could always script this command to do what you need.

However, I'm sure there is a better way - through Dll Calls or objects or something, but i don't know much about that.

Link to comment
Share on other sites

Sorry, yes it's Windows 2000. CACLS doesn't do extended permissions such as auditing. Nor does XCACLS.

I think VBScript can access these permissions, but I'm not good enough with VBScript yet to piece together all the snippets I've found and fill in the missing parts to make a really useful script. I'm surprised noone has needed this functionality before, or hasn't posted it on the Internet.

Link to comment
Share on other sites

  • 4 months later...

I'm trying to set extended permissions on files/dir too , and CACLS.exe is definitively not the solution.

It took me a long time on this forum, and with google, to get the begining of a solution.

The solutions seems to be the use of SETACL ( http://sourceforge.net/projects/setacl) witch is referred on other subjects on this forum, but has registry tool.

I will test setacl in a few days and bring some news here.

Edited by sksbir
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...