image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
LinkBack Thread Tools
  #1  
Old November 3rd, 2008, 02:52 AM
Registered User
 
Join Date: Mar 2007
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
yogish is on a distinguished road
Question How to unlock a locked file

Hi,

I am trying to delete a files using remove(). But, the locked file fails in remove() .
I am looking for the api/function to unlock a locked file.
Does anyone knows how to unlock a locked file .

Thanks
Reply With Quote
  #2  
Old November 9th, 2008, 01:21 AM
Frida's Avatar
Registered User
 
Join Date: Jul 2003
Location: Australia
Posts: 172
Thanks: 1
Thanked 1 Time in 1 Post
Frida is on a distinguished road
If you click once on the file and go to the File menu and select 'Get Info', under the 'General' setting in the info window there is a little tick box which says 'Locked'. Make sure it is not ticked, then delete the file by moving it to the trash and emptying it. You could also delete is by holding down the Alt/Option key when emptying the trash.
__________________
Intel Core 2 Duo iMac 2.16GHz • ATI Radeon X1600 • 2.5Gb • 10.5.6 • Epson CX6500 • Canon PIXMA iP4200 • ADSL
1.25GHz eMac G4 17" • ATI Radeon 9200 • 768Mb • 10.4.11 • HP Deskjet 840
Reply With Quote
  #3  
Old November 9th, 2008, 07:56 AM
ElDiabloConCaca's Avatar
U.S.D.A. Prime
 
Join Date: Aug 2001
Location: San Antonio, Texas
Posts: 14,416
Thanks: 10
Thanked 642 Times in 604 Posts
ElDiabloConCaca is a splendid one to beholdElDiabloConCaca is a splendid one to beholdElDiabloConCaca is a splendid one to beholdElDiabloConCaca is a splendid one to beholdElDiabloConCaca is a splendid one to beholdElDiabloConCaca is a splendid one to beholdElDiabloConCaca is a splendid one to behold
I think since this is posted in "Software Programming & Web Scripting" that the original poster is looking for a way to unlock a file via some programming API (as stated in the original post) -- not by directly manipulating the file with the Finder.
__________________
2009 Mac mini 2.0GHz • 2010 MacBook Air 11" • 2010 MacBook Pro 13" • LED 24" Cinema Display
PowerMac G4 MDD dual 1.25GHz • PowerMac G4 Yikes! • iPad 2 32GB • 2 x iPhone 4 16GB • iPod Touch 8GB • iPod nano 1GB • iPod shuffle 1GB • AirPort Extreme dual-band • AppleTV
http://www.jeffhoppe.com
Reply With Quote
  #4  
Old November 9th, 2008, 02:10 PM
Frida's Avatar
Registered User
 
Join Date: Jul 2003
Location: Australia
Posts: 172
Thanks: 1
Thanked 1 Time in 1 Post
Frida is on a distinguished road
Quote:
Originally Posted by ElDiabloConCaca View Post
I think since this is posted in "Software Programming & Web Scripting" that the original poster is looking for a way to unlock a file via some programming API (as stated in the original post) -- not by directly manipulating the file with the Finder.
Well, then it's above my head
__________________
Intel Core 2 Duo iMac 2.16GHz • ATI Radeon X1600 • 2.5Gb • 10.5.6 • Epson CX6500 • Canon PIXMA iP4200 • ADSL
1.25GHz eMac G4 17" • ATI Radeon 9200 • 768Mb • 10.4.11 • HP Deskjet 840
Reply With Quote
  #5  
Old November 18th, 2008, 04:52 AM
Mikuro's Avatar
Crotchety UI Nitpicker
 
Join Date: Mar 2005
Posts: 2,819
Thanks: 8
Thanked 74 Times in 64 Posts
Mikuro has a spectacular aura aboutMikuro has a spectacular aura about
I'm not sure how to do it in straight C, but you can do it via AppleScript like this:
Code:
tell application "Finder"
	set the locked of file "Mac HD:path:to:file" to false
end tell
Or if you want to use Unix-style paths instead of HFS-style paths, like this:
Code:
tell application "Finder"
	set the locked of file (posix file "/path/to/file") to false
end tell
You can also use the SetFile Terminal command:
Code:
SetFile -l /path/to/file
__________________
Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.8
MacBook Pro — 2.26GHz C2D, 8GB RAM — OS 10.6.8

Useful programs: Privoxy, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -5. The time now is 10:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Copyright 2000-2010 DigitalCrowd, Inc.