fogbound.net




Mon, 21 Apr 2025

Fixing an rsync issue under Mac OS 15.4

— SjG @ 1:18 pm

I keep some directories synchronized between my notebook and desktop with rsync. After upgrading my desktop to Mac OS 15.4.1, I started getting errors:

[sjg@BigThud 2025-04-21 13:01:05] ~/Documents/Backup
$ rsync -auP . sjg@10.3.2.xx:Documents/Backup
(sjg@10.3.2.xx) Password:
rsync: failed to set times on "/Users/sjg/Documents/Backup/Whatever": Operation not permitted (1)

Interestingly, ssh also showed an error:

[sjg@BigThud 2025-04-21 13:04:29] ~/Documents/Backup
$ ssh sjg@10.3.2.xx "ls /Users/sjg/Documents/Backup/Whatever"
(sjg@10.3.2.xx) Password:
ls: /Users/sjg/Documents/Backup/Whatever: Operation not permitted

On the desktop, I look again at Documents/Backup/Whatever, and the permissions are fine. What gives?

To make a long story short, something in the latest update on the desktop changed sshd‘s full disk access permission. Looking at System Preferences > Privacy & Security > Full Disk Access, sshd-keygen-wrapper was checked, so it should have been enabled. I tried toggling that, but it didn’t help.

Apparently, the sshd-keygen-wrapper was pointing at an old version or something? I had to go into System Preferences > General > Sharing and turn Remote Login off then on again, then go into System Preferences > Privacy & Security > Full Disk Access and re-enable sshd-keygen-wrapper.

Et voilà, I could ssh and rsync again!


Tue, 12 Nov 2024

Directory structure compare

— SjG @ 11:39 am

There’s gotta be a better way. But after a horrible upgrade process for a horrible commercial open-source product, I need to see which sub-directories from the old installation are missing in the new one. Don’t ask. I’ve literally been having nightmares about this upgrade.

Anyway, given tree1 and tree2 under some common point, I want a list of directories that exist in tree1 and don’t exist in tree2.

Here was my clumsy way of solving the problem.

cd tree1
find . -type d -print | sort > ../dirs_old
cd ../tree2
find . -type d -print | sort > ../dirs_new
cd ..
comm -23 dirs_old dirs_new


Fri, 11 Oct 2024

Quick file size computation

— SjG @ 2:13 pm

So your site was using too much bandwidth, and you converted all those animated .gif images to .webp using the WebPShop plugin.

But how many bytes have you actually saved? The command line will tell you:

ls -l *.gif | awk '{ print $5 }' | paste -sd+ - | bc 
ls -l *.webp | awk '{ print $5 }' | paste -sd+ - | bc 

Of course, this assumes that all the files in the current directory are the images and their conversions, and there aren’t a bunch of other files with one of those extensions. If that’s not the case, you’ll need to be more specific than *.extension in the ls command.


Tue, 10 Oct 2023

Which files are dupes

— SjG @ 4:56 pm

Over the past six months, I’d copied a set of files down from a network drive, then new ones were added to the network drive, and I’d copied some of the new ones down but maybe not all? How could I possibly clean up this mess?

Easily, it turns out!

$ diff -srq /mnt/Volumes/2023/Bank_Statements/ /local/receipts/2023/

This will list all the files, and mark if they’re only in the /mnt/Volumes/2023/Bank_Statements/ directory, only in the /local/receipts/2023/ directory, if the file exists in both places but is different, or if the file exists in both places and is identical. The -s flag means “report identical files,” the -r flag is to go recursively, and the -q flag just announces the files are the same/different rather than showing their differences.

This’ll work as long as the file names have not been changed. If file names have changed, it’ll require a more robust utility.


Mon, 21 Aug 2023

Another “sed” one-liner

— SjG @ 1:22 pm

I needed to generate a comma-delimited, quoted list of all the .svg image files in a directory, but without the extension.

This worked:

ls -1 ./svgs | sed 's/.*/"&"/' | sed 's/\.svg//' | paste -sd, -

Hooray for the command-line!

(coming soon, why I needed that list…)

Filed in: