How to remove the "locked" flag (programmatically)
I just found the command to do so:
chflags nouchg FILENAME

The command is described here

(MacOS Monterey):
I have external hard disks with files written under Windows, using Cygwin rsync.
The files are perfectly readable under MacOS, but when I want to delete/overwrite them, quite some appear "locked" (operation not permitted when doing a rm) on MacOS. Using the Finder, I can remove the lock by getting the context menu on the file, choose "GetInfo", and unchecked the Locked property.
But there are too many of them to do it by hand. I would like to run recursively over the file tree and uncheck the "locked" attribute programmatically. Of course the problem is not the traversal of the directory tree (can done by find for instance), but the change of the attribute from the command line.
chmod does not help here (as the files are 0777). Any other command I can use?
