Latest or all posts or last 15, 30, 90 or 180 days.
Upgrade the memory of your 2018 Mac mini up to 64GB
Handpicked deals...
$2499 $1899
SAVE $600

$390 $270
SAVE $120

$1798 $1598
SAVE $200

$3297 $2797
SAVE $500

$3397 $2797
SAVE $600

$150 $90
SAVE $60

$1398 $898
SAVE $500

$3698 $2998
SAVE $700

$2998 $2498
SAVE $500

$1799 $1299
SAVE $500

$1999 $1199
SAVE $800

$2299 $1599
SAVE $700

$2399 $2049
SAVE $350

$2799 $2399
SAVE $400

$2799 $1899
SAVE $900

$1199 $920
SAVE $279

$1349 $1049
SAVE $300

$997 $897
SAVE $100

$2099 $1699
SAVE $400

$1999 $1349
SAVE $650

$1999 $1599
SAVE $400

$1329 $929
SAVE $400

$4499 $3999
SAVE $500

$329 $329
SAVE $0

$1499 $999
SAVE $500

$1499 $1289
SAVE $210

$1299 $1124
SAVE $175

$2199 $1999
SAVE $200

$3399 $2199
SAVE $1200

Workflow Tip: Locking DNG Files to Prevent Modification by Lightroom/Photoshop, Greatly Reduces Backup Time

Update: several readers have asked “what is a command line”. A very reasonable question. If it were trivial to answer/explain how to use, I’d have done so. See a brief introduction at the end of this page, which ought to scare you off!

...

As a sort of side project, I am implementing a home/family images server which auto-generates HTML pages of arbitrary numbers of folders from JPEGs.

For example, a folder of images “2013-0804-RicohGR-BeachWithGirls” will turn into a page for August 4 2013, e.g., 2013-0804-RicohGR-BeachWithGirls.html, organized by date with other pages. Quite similar to the index pages on the site for a publication, such as that for diglloyd Mirrorless.

The issue I ran into almost immediately is the need to generate JPEGs for all the raw files. This is easy enough with Photoshop or Lightroom. However, Photoshop is brain-dead with respect to file naming (e.g., it uses today’s date instead of the creation date), so Lightroom it is*.

*I want the JPEG to be of the form (creation date/time) YYYY-MMDD_HHMMSS-<filename>.jpg, as that form provides simple metadata for organization by time of day within a page.

But I quickly was reminded that Adobe modifies original DNG files when any change is made to processing parameters. This is unacceptable for multiple reasons:

  • Original are originals, and should never be changed IMO. Changes immaterial to the image itself alter the file, so data integrity checking will flag it as changed, a nuisance factor at the least.
  • Changing DNG originals means that every changed DNG has to be backed-up again. That’s a 10000X waste of time and storage. In my case, a massive backup would happen, along with tedious backups of every DNG file every time a change is made.

Adobe should NOT be changing the DNG files IMO, at least not by default. I’m sure that some people don’t care about longer and larger backups, or don’t want XMP sidecar files, but I do. The default behavior should NEVER be about modifying original user data.

Solution to Adobe modifying DNG files

Update: reader Sebastian B notes that Lightroom will not update XMP sidecar files for locked DNG files (though it works fine with other raw formats), so this locking approach might not be acceptable for Lightroom users. Photoshop/ACR *does* write XMP sidecar files for locked DNG; I do that all the time.

The solution is simple at the command line: bulk-lock all DNG files. This causes Photoshop and Lightroom to write sidecar XMP files instead of modifying the DNG files.

I save this shell script as "lockDNG". It locks all files recursively in the current directory. It needs to be run inside a command line (Terminal on macOS) in the desired directory/folder.

#!/bin/sh # ©2016 DIGLLOYD INC
# Lock all DNG files in current directory, recursively
#find . -name "*.DNG" -exec  chflags -v uchg {} \; 
find . -iname "*.dng" -print0 | xargs -0 chflags -v uchg

Carbon Copy Cloner does not consider the lock flag a change, so after this bulk lock, a backup clone did not do a fresh copy-over. But it does set the lock flag on the clone backup files and does so very quickly for 8TB of data.

Should the need to unlock arise, unlocking can be done also, save as script unlockDNG:

#!/bin/sh # ©2016 DIGLLOYD INC
# Unlock all DNG files in current directory, recursively
#find . -name "*.DNG" -exec  chflags -v nouchg {} \;
find . -iname "*.dng" -print0 | xargs -0 chflags -v nouchg
Locked DNG files in macOS Finder window

Mark A writes

This is a more robust command line:

find . -iname "*.dng" -print0 | xargs -0 chflags -v uchg

find . -iname "*.dng" -print0 | xargs -0 chflags -v nouchg

It will work on files named .DNG .dng .DnG etc and because of the shell interpretation issues with find's file name replacement stragegy, it will fail on files that contain embedded whitespace, for example. The print0 alleviates that by using nulls as stream delimiters. Lastly, xargs knows about null-delimited streams and will optimize calling chflags on a large number of file names vs. one at a time which is how the original script would operate. These are good tips overall when using the find command and apply to pretty much all use. I rarely use find without such precautions.

DIGLLOYD: proving that there are levels of nerd-dom, this looks a lot better than my primitive approach. I don’t use files with spaces in the name, but it is far better practice as Mark points out, to use a null as a delimiter between command line arguments (the file names in this case). From the man page for 'find' (“man find”):

 -iname pattern
Like -name, but the match is case insensitive.
-print0
This primary always evaluates to true.  It prints the pathname of the current file to standard output,
followed by an ASCII NUL character (character code 0).

What is a “command line”, for novice nerds

This is no more than a very brief synopsis, but it gives a sense of what is involved—surely beyond the interests of most. But for those who want a new and highly powerful tool, learning the command line is an investment that can pay handsome dividends.

A command line is an interface that accepts text-based commands typed in as input, and emits text as output. Using it effectively requires concepts such as current directory, file and folder paths, command syntax and so on. On unix, you’ll often hear the word “shell” which means the program accepting those commands.

A “command line” is how all computers worked until the Apple Mac and Microsoft Windows and other GUI interfaces came along; it is the only computer interface I had to use at first back at Stanford years ago. Even today, command lines are indispensible tools for developers, system administrators, etc. I use the command line while working each and every day, quite heavily and frequently, as it is far more efficient for numerous tasks.

While most people using macOS think it all graphical, underneath it is Unix, and the Terminal program on macOS (in /Applications/Utilities) uses the Unix shell, 'bash' by default (there are many choices of shell). [Windows has a vastly inferior shell, the DOS prompt. Even when I had to use Windows for work years ago, I dreaded the unlovely DOS prompt shell and its crappy “.bat” files. There are unix shells for Windows instead.]

I have a brief overview of using the command line for diglloydTools, but it is not a general primer. Here are some resources to start with.

A quick taste

  1. On macOS, open the Terminal program, found in /Applications/Utilities folder.
  2. Type "ls" (those two letters, without quotes), then press the ENTER or RETURN key.

It will look something like this. The stuff in gray is the “command prompt”. The blue “ls” is the command, and the stuff below is the output from ls. Try “man ls” for command line help on the ls command.

diglloyd-iMac:~ lloyd$ ls
Applications Desktop      Documents    Downloads    Library      
Movies       Music        Pictures     Public       Sites 

Our trusted photo rental store
View all handpicked deals...

Samsung 2TB T5 Portable Solid-State Drive (Black)
$390 $270
SAVE $120

diglloyd Inc. | FTC Disclosure | PRIVACY POLICY | Trademarks | Terms of Use
Contact | About Lloyd Chambers | Consulting | Photo Tours
RSS Feeds | Twitter
Copyright © 2019 diglloyd Inc, all rights reserved.