Search code examples
ubuntudirectoryfilepathmv

Ubuntu - mv: moving a directory


I'm still new to Ubuntu and the commands... and i'm trying to move jdk1.7.0_02 directory to a file/directory path using this command..

sudo mv ./jdk1.7.0_02/usr/lib/jvm/jdk1.7.0

i've already uncompressed a zipped jdk7u2 folder using the sudo command. it extract into the jdk1.7.0_02 directory

i even went to this Examples of mv commands

http://unixhelp.ed.ac.uk/tasks/mv2.html

so i tried this:

sudo mv jdk1.7.0_02 ./jdk1.7.0_02/usr/lib/jvm/jdk1.7.0

got this error:

mv: cannot move ‘jdk1.7.0_02’ to ‘./jdk1.7.0_02/usr/lib/jvm/jdk1.7.0’: No such file or directory

so please anyone can help me understand and solve this... thanks so much :D


Solution

  • mv takes two arguments source and destination. sudo mv ./jdk1.7.0_02/usr/lib/jvm/jdk1.7.0 command has no destination. sudo mv jdk1.7.0_02 ./jdk1.7.0_02/usr/lib/jvm/jdk1.7.0 in this command you are moving directory inside itself. Consider cutting a directory in Windows and pasting it by going inside that. That is exactly what you are doing. What you should rather do is something like sudo mv jdk1.7.0_02 jdk1.7.0. That makes source and destination separate and not overlapping.