I needed to remove a fair number of large files from a directory. I used ‘rm * ‘ to remove the files and went to another screen to work on something else. A while later, I used ‘rm * ‘ on the same directory, forgetting that I’d already done that.
I got an error saying “rm: cannot remove `filename’: No such file or directory.”
Then I went to the first window and there was a similar error.
Are the screens racing to see which finished the rm first? Or does the server thread the processes somehow? How do servers’ screens work with one another when they execute the same command on the same directory?
In each case,
rming is just unlinking a directory entry per-file. The two processes are racing each other but are likely “threaded” together only by context switches from one process to another. If one prepares to unlink a file, then gets context switched out, its competitor will likely get the chance to unlink the same file. Then when the first returns, the file is no longer there, so he moves onto the next entry that is there.As heximal says, in this case (
rm *), the asterisk has already been expanded into a list of files, which means that you should, between the two processes, get a full listing that every file you wanted to delete was already gone.