December 9, 2013

How do I rename a file in another directory?

I am here: /volumes/Thor/xinu/nov/ I've moved over myfile.txt into /tmp/mymac/tuesday/thirteen When trying to use mv I end up moving the file back into the previous directory... I know i have some issues in my command.... just cant figure it out!

use...

use
mv /tmp/mymac/tuesday/thirteen/myfile.txt /tmp/mymac/tuesday/thirteen/newmyfile.txt

make sure to use absolute path in destination.

Like  (0 likes)

My guess is you are doing something similar to this:...

My guess is you are doing something similar to this:
$ pwd
~/
mv Documents/test111 test999
Then discovering that test999 is in ~/
This is because the syntax for mv is /path/to/filename /path/to/newfilename
So you are instructing each time to move it into the current directory on the second arguement

So instead of mv /tmp/mymac/tuesday/thirteen twelve
do:
mv /tmp/mymac/tuesday/thirteen /tmp/mymac/tuesday/twelve
or, (cd /tmp/mymac/tuesday mv thirteen twelve)

Like  (0 likes)
Click Here!