Mac terminal command returns permission denied, ran again and it worked fine I ran the following command in the terminal of a Mac Pro running Mac OSX 10.6.8.

rm -rd /Users/Shared/SomeFolder


This command resulted in

rm: /Users/Shared/SomeFolder: Permission denied


Without changing anything, I immediately ran that command again, and it worked. What caused this to happen?
It's possible there was a write-lock on that folder when you attempted the first rm. An application or process could have been indexing or accessing the folder. Things like Mozy Backup or the Spotlight Search run in the background and access most all files on a file system.