Reputation: 76
An error occurs when I ran this command on a RedHat server where data
was a directory:
rm -rf data; cp -r another_dir data
An error occurs with this command:
cp: cannot create directory `data/test': File exists
This error does not always happen. Usually when I see this error I can simply rerun the commands and it would succeed. Also, changing the ;
sign to a $
does not solve this problem.
I simply don't understand. How could this even be possible?
Upvotes: 0
Views: 290
Reputation: 79
What is data? A directory or a file ?
If that is a directory try rmdir data
If it is a file , try rm -f data
Since rm -rf data;cp -r another_dir data
is two different commands . So just try one by one and give me the result
Upvotes: 1