Files Can't Be Changed & Operation Can't Be Completed Errors

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hey Hazel team,

Thanks so much for Hazel, it's one of my favorite Mac apps and has been for a long time.

I'm running dhy8386's "My Perfect Photo Management Process using Dropbox & Flickr" (viewtopic.php?f=3&t=3331) Hazel rules. Yesterday:

  • I copied several jpgs off my Canon's memory card
  • I moved them into the directory with my Hazel rules
  • Hazel processed the "Rename to Date at Time.ext" rule:

Image

Here's the embedded script it runs:
Code: Select all
exiftool -api QuickTimeUTC -d '%Y-%m-%d at %H-%M-%S' \
 '-filename<${FileModifyDate;}%-c.%e' \
 '-filename<${GPSDateTime;}%-c.%e' \
 '-filename<${MediaCreateDate;}%-c.%e' \
 '-filename<${CreationDate;}%-c.%e' \
 '-filename<${DateTimeOriginal;}%-c.%e' \
 "$1"

Here's the relevant log section:
Code: Select all
2023-01-26 19:17:05.130 hazelworker[16765] IMG_1493.JPG: Rule Rename to Date at Time.ext matched.

2023-01-26 19:17:10.890 hazelworker[16765] [File Event] File renamed: /Users/Ryan/Library/Mobile Documents/com~apple~CloudDocs/Photos/PhotoSync/Ryan’s iPhone/IMG_1493.JPG renamed to /Users/Ryan/Library/Mobile Documents/com~apple~CloudDocs/Photos/PhotoSync/Ryan’s iPhone/IMG_1493.jpg.

I looked in the FInder and the files did have the orange label applied and were renamed correctly using the script (i.e. IMG_1493.JPG to 2021-11-19 at 21-33-22.jpg). However, they did have these errors:
  • "One or more items in "/Users/Ryan/Library/Mobile" can't be changed because they are in use" when I tried to edit them (i.e. remove a tag)
  • "The operation can’t be completed. An unexpected error occurred (error code -8076)" when I tried to select multiple files
I opened Terminal, cd'd into the directory, ran 'ls -l@' and each file had this metadata:
Code: Select all
com.apple.FinderInfo
com.apple.metadata:_kMDItemUserTags
com.apple.provenance

I went through the logs and here are the relevant entries for one of the files (2021-11-19 at 21-33-22.jpg):
Code: Select all
2023-01-26 19:17:29.496 hazelworker[16765] File 2021-11-19 at 21-33-22.jpg is busy. Skipping for now.

The above error message repeats 22 times from 19:17:33-19:29:32. I paused Hazel, removed the metadata from the files using this command:
Code: Select all
xattr -d com.apple.FinderInfo *; xattr -d com.apple.metadata:_kMDItemUserTags *

This fixed both errors. I unpaused Hazel and then Hazel ran the rest of my rules successfully:
Code: Select all
2023-01-26 20:32:12.593 hazelworker[3484] 2021-11-19 at 21-33-22.jpg: Rule Author & FileModifyDate<DateTimeOriginal matched.

2023-01-26 20:32:14.944 hazelworker[3484] 2021-11-19 at 21-33-22.jpg: Rule Color & Move Images matched.

2023-01-26 20:32:14.946 hazelworker[3484] [File Event] File moved: 2021-11-19 at 21-33-22.jpg moved from folder /Users/Ryan/Library/Mobile

I'm running the latest version of ExifTool from Jan. 17, 2023 (https://exiftool.org). Here's the full Hazel log: https://gist.github.com/ryanburnett/b27 ... 97c0f83abc

Any ideas how to prevent these files from getting the "can't be changed because they are in use" and "the operation can’t be completed" errors?

Thanks again! 8)
ryansebiz
 
Posts: 18
Joined: Sun Sep 14, 2008 9:43 pm

Unfortunately, the original dev's site is gone but there is an app called WhatsKeepingMe that will show which app has the file open. If you are comfortable using the commandline, you can use the lsof program to do the same thing.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron