Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to unlock files in script

OS X 10.7 (Lion) locks files that have not been edited within some period of time. When I try to run a batch script on such files, I get an error. I am using GraphicConverter.app to resize and renumber .jpg files in a selected folder. If I open each file manually, I get a dialog box which asks if I want to unlock the file. I suspect there must be a way to use GUI scripting to unlock each file individually, but that seems a terrible solution. Does anyone have a better solution to this, like one to unlock all files in the selected folder? I have reported the problem to Lemke Software, so they are aware of it but offered no solution so far.

Posted on Aug 3, 2011 1:22 PM

Reply
6 replies

Aug 4, 2011 7:06 AM in response to Pierre L.

Pierre L. wrote:


However, if the “locked” property of some files is set to true, the script should be modified as follows:


set theFolder to choose folder

tell application "Finder"

set locked of every file of folder theFolder to false

set modification date of every file of folder theFolder to current date

end tell


It takes both those lines in finder to unlock and keep the files unlocked. Neither of those lines by themselves seems to work.

Aug 4, 2011 7:13 AM in response to Niel

Niel wrote:


Use a script such as:


tell application "Finder"

set locked of every item of entire contents of desktop to false

end tell


changing the path as needed.


I ran that for my individual file and it produced no apparent effect. So, I ran it for my desktop, which happened to contain numerous locked files and it seemed to be doing something, the HD was churning away for about three minutes when the script produced an "AppleEvent timed out." error. Then the system went into a frozen state. I left it to run after several minutes but it eventually cleared itself. I found no files unlocked, however.

How to unlock files in script

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.