26 July 2012

"Invalid Argument" when trying to delete files - VMware

Recently I tried to delete some files in the VMware shell and I got an "Invalid Argument" error...

In order to resolve this, I tried chmod 755 * and it didn't work. Individual file deletions, not working. Short of a reboot (which would have been a drastic step given that this is a production host) I instead tried to overwrite the file contents with new data to see if it would somehow unlock the file locks (which seemed to be the issue here).

This is what worked for me from the working directory with the files (this command will write the "a" character into each file as a new file, so all previous data will be lost - make sure you are in the proper working directory!!):

echo "a" > *

The files were then unlocked and I could do my usual rm * and it was done. Hope this helps someone else out there!

No comments: