I am receiving an error when trying to mv some files that really doesn't make sense. I receive this error:
mv: cannot move `thatDir' to a subdirectory of itself, `/usr/local/apache-tomcat-6.0.32/webapps/thatDir'
When running the following command to replace an already existing thatDir in /webapps:
From /home/myUser/war_files/ mv thatDir /usr/local/apache-tomcat-6.0.32/webapps
I have also tried everything up to:
sudo mv /home/myUser/war_files/thatDir /usr/local/apache-tomcat-6.0.32/webapps
With no luck. I have the necessary permissions to do this (plus I'm using sudo) and still nothing. This exact same operation has been carried out before by someone else at my office (who is no longer working here).
I've tried googling around and even have seen another question on serverfault but everyone says the same this as the comment on that issue: "perhaps there are symlinks involved and you don't know about it."
That is not the issue. I tried viewing the directories with readlink -e (as the comment in the other ticket suggests) but there are no symlinks involved.
Any help would be appreciated.
Link to the other question related to this: Cannot move folder to a subdirectoy of itself - What's going on?
As mentioned in my comment response below, here are steps to reproduce this issue. As you will be able to see, links could not be responsible for this (also, I am using bash unix):
mkdir /home/myUser/testOuter cd /home/myUser/testOuter mkdir test1 cd test1 mkdir moveMe cd moveMe touch testfile1.txt cd ../.. mkdir test2 cd test2 mkdir moveMe cd moveMe touch testfile2.txt cd ../../test1 mv moveMe ../test2
And then I get the error output:
mv: cannot move `moveMe' to a subdirectory of itself, `../test2/moveMe'
but it is clearly not in a subdirectory of itself, nor are there any links involved.
It works if I remove the files from
test2/moveMe/ but that is unacceptable as I need to overwrite all files that are in test1 with test2, preserve existing files in test1 that do not exist in test2 (such as user generated content), and move in any files from test2 that do not already exist in test1. (ie. a regular, every day type of move operation).