8 Replies Latest reply on Jan 7, 2011 2:29 PM by areohbee

    ATTRIB +R

    areohbee Level 5

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

        • 1. Re: ATTRIB +R
          johnrellis Most Valuable Participant

          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...

          • 2. Re: ATTRIB +R
            areohbee Level 5

            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

            • 3. Re: ATTRIB +R
              jarnoh Level 1

              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

              • 4. Re: ATTRIB +R
                areohbee Level 5

                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

                • 5. Re: ATTRIB +R
                  johnrellis Most Valuable Participant
                  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.

                  1 person found this helpful
                  • 6. Re: ATTRIB +R
                    jarnoh Level 1

                    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

                    1 person found this helpful
                    • 7. Re: ATTRIB +R
                      johnrellis Most Valuable Participant

                      Interesting gratuitous difference between LR Mac and Windows.

                      • 8. Re: ATTRIB +R
                        areohbee Level 5

                        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