I’m trying to write a shell script that will look in the directory of an SD card for all files that are locked.
Then duplicate those files to a folder on the Mac.
The script fails as I can’t find the correct syntax to use for the IF file is locked part.
Can any kind soul help me out?
#!/usr/bin/env zsh -f #set -x sourceDir="/Volumes/MOBIUS/DCIM/" targetDir="~/Dropbox/Backups/Mobius\ Locked/" cd $sourceDir for file in *; do if [[ "$file" == -flags uchg ]]; then mv "$file" "$targetDir" fi done