Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ATTRIB +R

LEGEND ,
Jan 05, 2011 Jan 05, 2011

This command does not protect files from deletion by Lightroom - anybody know if its possible?

TOPICS
SDK
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 05, 2011 Jan 05, 2011

Hmm, it also doesn't protect deletion or moving to the Recycle Bin by Windows Explorer.

I've never bothered to really understand Windows permissions (which I relearn to regret every few years). But some experimentation suggests you'll have to to remove or deny the Write Attributes and Write Extended Attributes permissions using "icacls" to prevent Windows Explorer and LR from deleting or moving a file to the Recycle Bin.


But perhaps someone has a more authoritative answer...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 05, 2011 Jan 05, 2011

johnrellis wrote:

Hmm, it also doesn't protect deletion or moving to the Recycle Bin by Windows Explorer.

Silly me - I just assumed it did, since I've been prompted before whether I really want to delete read-only files... - I guess its an app-specific thing.

johnrellis wrote:

I've never bothered to really understand Windows permissions (which I relearn to regret every few years).

You and me both. It seems like the kind of thing that once you understand it, its hard to remember what its like to not, or something. The theory is relatively easy to understand, but its the devil in the details about just when and who decides and what user is in play when a particular thing is happening... I have backups that I can't open because I dont have permission. Say what??? Or documents and settings folders on a drive pulled from a different system that I cant open... Seems most educational material stops shy of the stuff you really need to know to deal with it in the real world. (or maybe I'm just being dense and not being fair...)

johnrellis wrote:

But some experimentation suggests you'll have to to remove or deny the Write Attributes and Write Extended Attributes permissions using "icacls" to prevent Windows Explorer and LR from deleting or moving a file to the Recycle Bin.

I'll look into it and report back - thanks a bunch John

Rob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 06, 2011 Jan 06, 2011

What are you trying to accomplish?

I think LR will anyway delete the catalog entry which would just make the raw file orphaned. If you want to protect files, I guess you have to implement a publish service, like in Jeff Friedl's plugin.

On the Mac side, things are not much better.  You can remove write permissions in command-line with chmod -w, but that does not stop Finder from deleting.

Finder has its own "locked" state, which can be managed using SetFile command - that will give warnings with inside Finder when moving to or emptying trash but e.g. command-line will still happily delete the file

Jarno

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2011 Jan 06, 2011

jarnoh wrote:

What are you trying to accomplish?

I was trying to protect files from being deleted by Lightroom.

I realize jf has a publish solution, but I was hoping for a quick-n-dirty addition to my ChangeManager plugin, which presently is limited to protection from inadvertent edit changes but won't keep a file from being inadvertently deleted.

Thanks for the info.

R

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 07, 2011 Jan 07, 2011
I think LR will anyway delete the catalog entry which would just make the raw file orphaned. If you want to protect files, I guess you have to implement a publish service, like in Jeff Friedl's plugin.

It appears that if LR can't move the photo to the Recycle Bin, then it doesn't get removed from the catalog.  I verified that by denying the permissions Write Attributes and Write Extended Attributes in Windows Explorer and then trying to remove the photo from the catalog.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 07, 2011 Jan 07, 2011

I tried it on Mac: readonly (chmod -w) files are moved to Trash.  Locked (SetFile -a L) files remain in place. In both cases, the catalogue entry is destroyed.  I used Delete photo/Delete from disk for testing.

Jarno

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 07, 2011 Jan 07, 2011

Interesting gratuitous difference between LR Mac and Windows.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 07, 2011 Jan 07, 2011
LATEST

jarnoh wrote:

Locked (SetFile -a L) files remain in place. In both cases, the catalogue entry is destroyed.

Thanks Jarnoh.

I have filed a bug report / feature request regarding the lack of respect for attributes (so to speak) before taking the liberty to delete. Maybe they'll eventually get the idea that some of us need a little protection from ourselves ;-}

I may use SetFile -a L in the future to protect files - they could always be added back to the catalog by a plugin - granted with some loss of data.

I suspect the same behavior would be observed in windows if the file were locked via some more serious means than ATTRIB +R. (e.g. icacls).

Rob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines