Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Gregg2

macrumors 604
Original poster
May 22, 2008
7,266
1,237
Milwaukee, WI
In trying to copy a folder "A" (which contains files, and other folders with files) to a flash drive, I got an error that said the operation could not be completed, because some files were locked. So, my goal here is to discover a way to unlock all files, or not, if that's not necessary. I don't know how the files became locked (I have a theory), but for now, I don't care. I just want to be able to copy files to my flash drive.

I tried chflags -R nouchg ~/Documents in Terminal, and that had no effect on files that I checked; still locked. Yes, all these folders and files are in my Home/Documents folder. I'm seeing a closed padlock in the lower right corner of the Get Info dialog boxes. Unlocking by clicking that and entering the Admin password opens the padlock. However, when I close the Get Info window and then check it again for that same file, it's Locked again! I have only checked in two folders, but I suspect that all my files are locked. I'd rather not have to unlock all my files, if I can get unlocking to stick!

From a different folder, I checked a file, and it was locked. I copied it to the flash drive, and got the alert sound signifying success. I also opened the file, made a change, then saved and closed it. When I reopened the file, the change was there. I thought one purpose of locking a file is so that it can't be changed unless you unlock it.(?) Anyway, I don't get why this message pops up if another locked file can be copied to the flash drive.(!)

Folder "A" had a notation "Waiting to Upload" in the Finder Window. Apparently the last time it was copied to the flash drive, there was an issue. I was hoping to copy it and solve whatever that issue was. No luck.

I'm also wondering if this issue is going to hose up my Time Machine backups. ?
 

Gregg2

macrumors 604
Original poster
May 22, 2008
7,266
1,237
Milwaukee, WI
Nope. That didn't work either. I guess I'm wrong about where my Documents folder is. It's on the iCloud Drive.

I wonder if I should move all my files to a folder on my hard drive.
Edit:
Before the iCloud Drive existed, my most important files were always in ~/Documents. I copied all the files (not a massive amount) to a flash drive, then, when any individual file was edited and saved, it got copied to the flash drive, replacing the old one.

When Apple introduced the iCloud Drive, I only used it as a backup to my backup on the flash drive, replacing those files about once a month by copying the contents of the flash drive to the iCloud Drive. From El Capitan through Mojave, this was my practice.

Recently, I replaced my computer. I restored my files to the new hard drive from my flash drive. I copied them to the Documents folder that was in the Sidebar. Only now am I realizing that this was not in my Home folder, as had always been the case, but is on the iCloud Drive.

So if I copy the files to a new ~/Documents folder, I'd be back to what I was used to. I wonder if this strategy would get rid of the error message (see post #1) and put my mind at ease with the assurance that files are getting copied to backups as before.
 
Last edited:

Slartibart

macrumors 68040
Aug 19, 2020
3,140
2,815
run chflags -f -R nouchg ~/Documents to remove the locked attributes via the terminal. Or use find with the uchg flags to identify the files. Additionally make sure that you expand spaces in file or subfolder names in the terminal.
 

Gregg2

macrumors 604
Original poster
May 22, 2008
7,266
1,237
Milwaukee, WI
@ Slartibart
Thanks, I tried that. It did not unlock the two files I checked afterwards, so I suspect it didn't unlock any of them. Did you note that I realized that the files are on the iCloud Drive? I think that's why these Terminal commands with ~/Documents are not doing anything.

I also added an Edit to my post #3 after you posted.
 

Slartibart

macrumors 68040
Aug 19, 2020
3,140
2,815
@ Slartibart
Thanks, I tried that. It did not unlock the two files I checked afterwards, so I suspect it didn't unlock any of them. Did you note that I realized that the files are on the iCloud Drive? I think that's why these Terminal commands with ~/Documents are not doing anything.

I also added an Edit to my post #3 after you posted.
sorry, I - apparently - did a macrosaccade over the iCloud-part. Can you actually copy these “locked” files from iCloud without problem to your local storage, internal or external?

EDIT: what happens if you use the terminal commands on the local ~/Library/Mobile\ Documents/com~apple~CloudDocs/ ? will this then be propagated to the “real” iCloud data?
 
Last edited:

Gregg2

macrumors 604
Original poster
May 22, 2008
7,266
1,237
Milwaukee, WI
Thanks for your attentiveness to this thread.

Not that I'm a Terminal guru, far from it, but the "Mobile\[space]Documents" part confuses me. I see that in my ~/Library folder, there is a folder called Mobile Documents. That's the iCloud Drive by another name, because when I open Mobile Documents, it shows me a Finder Window titled iCloud Drive, and one of the folders is the Documents folder with the "dog-eared" paper icon on it. In that folder, I find all my folders and files. It is apparently the same folder that is opened from the "Documents" listed under iCloud Drive in finder window sidebars.

Anyway, what would you expect to happen if the command you suggested is entered in Terminal?

Yeah, I also wonder if I can copy these folders and files from the iCloud Drive to a new Documents folder that I would create in my Home Folder. It's entirely appropriate to put locked in quotes as you did, since these seem to be the files I edit and copy to my flash drive, usually without the warning noted in post #1.
 

Slartibart

macrumors 68040
Aug 19, 2020
3,140
2,815
from what you posted I conclude - because I’m currently on iPad somewhere in the outback of northern europe camping - and I can not really check this besides via a-Shell and I’m not sure wether my findings are 100% transferrable to MacOS- it is not easily possibly to use the terminal on iCloud - but if I understand the process right, iCloud just propagates what is happening locally to the cloud (?). Files that locked locally will end up locked on iCloud and therefore it seems logic to change file states locally. You’re on @Gregg2 🤜🤛🤓
 

BanditoB

macrumors 6502
Feb 24, 2009
482
258
Chicago, IL
Have you checked to make sure that the files that are locked are not open on any of your Macs? If they are closed everywhere, they shouldn't be locked and you should be able to copy them.

Another way to help ensure that all files are unlocked is to reboot the computer. This should release all files.
 

Gregg2

macrumors 604
Original poster
May 22, 2008
7,266
1,237
Milwaukee, WI
One Mac. Yes, I've made sure that files were closed that I was looking at in Get Info. I shut down and reboot at least 360 days a year. So each time I've checked this, I've recently rebooted.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.