Jump to content

need help creating a script to prevent renaming/deleting a folder...


Sog
 Share

Recommended Posts

Hi All, Im trying to write a script to prevent my dad deleting/renaming certain folders on his computer as hes getting a bit forgetful and keeps deleting/renaming "special" folders. so I end up having to reconfigure his pc almost weekly. the folders in question are My Documents/pictures/music along with some Ive created (eg Scanned Images). Ive tried delving into folder permissions but that ends up meaning he cant create his own folders etc within the 'locked' ones. is this even possible? Ive tried many search terms here to no avail... Just a pointer in the right direction will be a massive help,

cheers, sog.

(Its a windows xp pro pc)

Link to comment
Share on other sites

it can be done with permissions however you may have to play with it a bit. of course it goes without saying to create backups before you try it.

select the folder <for example; pictures> right click it; choose the security tab. click 'advanced' then the effective permissions tab.

be sure delete is unchecked.

check 'delete subfolders and files'

check 'create files / write data'

check 'create folders / append data'

try that and then start playing to see what else may have to be set.

you might also want to consider changing his account from an admin account to a user account. if you do that; make sure to create a new user account for you with admin rights and hide it. set a password on his account and then search the web for the settings to autolog onto his account.

more info is available here

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hi GEOsoft, Thanks for your reply, Ive been playing around with permissions for days (with the help of windows related sites) but it seems it cant be done. I am the hidden admin on his PC, but any combination of settings means either the folder cannot be renamed/deleted but you cant change the contents but any setup that lets him create/modify/delete folders or files within it also means he can delete/rename the folder. he needs admin rights to be able to use some of the programs he uses.

Ive turned to Autoit as this has been a god send to me in the past and is a very powerful tool but cant seem to find the info I need to get started. thanks again for your help but I feel I've exhausted the permissions variations and I'm sure Autoit is the way foreward, cheers, Sog.

(edited spelling)

Edited by Sog
Link to comment
Share on other sites

Update: it must be something weird with my dads PC configuration as it wont let me select the check boxes needed to do what I want as it automatically selects other boxes preventing him from altering files once they're in the folder (eg, the scanner puts them in the scanned images folder but he cant then crop or rename them, strangely he can delete them or move them out of the folder and then edit them!) I guess I'll try a different tac...

would an Autoit prog that watched folders then popped up a warning msgbox use much of his precious resources?

Link to comment
Share on other sites

  • 4 weeks later...

It's very basic but here it is... simply edit/add filepaths to 'C:sogslocker.ini' each path's key should be numbered consecutively

eg,

[ToLock]

1=D:My DocumentsMy PicturesScanned Images

2=D:My DocumentsMy Pictures

3=D:My Documents

#include <LockFile.au3>
If Not FileExists("C:sogslocker.ini") Then IniWrite("C:sogslocker.ini", "ToLock", "1", "D:My DocumentsMy PicturesScanned Images")
$c = 1
While 1
$ini = IniRead("C:sogslocker.ini", "ToLock", $c, "END")
If $ini = "END" Then ExitLoop
LockFile($ini & "~sogsfolderlocker.txt", 1)
FileSetAttrib($ini & "~sogsfolderlocker.txt", "+RSH")
$c = $c + 1
WEnd
While 1
WEnd
Edited by Sog
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...