LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MV command question. (https://www.linuxquestions.org/questions/linux-newbie-8/mv-command-question-637354/)

swamprat 04-23-2008 03:20 PM

MV command question.
 
Hello,

I have a question regarding the MV command.

I have a file in the root directory that I have to move to a directory on my floppy drive.

The floppy is mounted correctly now and I can see the target directory called 'testdir' and another file in it.

I can't seem to get the 'mv' correctly set up as the file seems to wind up some place else. I was doing the following:

mv /testfile.txt (which is in the root) /mnt/floppy/testdir

I also tried to mv another file from the floppy to the /root directory and that also go messed up as the file got placed into the '/' directory.

I'm new at this but slowly getting the hang of things.

Thanks.

dasy2k1 04-23-2008 03:31 PM

to do the first thing try

mv /testfile.txt /mnt/floppy/testdir/testfile.txt

and the second

from the floppy dir
mv ./testfile.txt /root

(you need to do that one as root as only root can acsess /root)

if you are just learning command line skills i would STRONGLY recommend not doing this as root but as a normal user.
there is too much chance of messing things up as root

jei 04-23-2008 03:33 PM

I usually cd into the dir i'm going to move the file FROM.

mv file.txt /mnt/floppy/testdir/

In rare occasions I have seen leaving off the trailing / to actually put the file in the root of the /floppy/ folder as a file named testdir or give an error

You could also use cp file.txt /mnt/floppy/testdir/ then rm file.txt if it just won't work, but it should.

One more method cd into the testdir and do mv /path-to-file/file.txt .
that should put the file into the dir your in.

swamprat 04-23-2008 06:40 PM

Thanks Jei...

okos 04-23-2008 08:56 PM

Try
ls -l /mnt/floppy/testdir/

What do you get?

Perhaps you are not moving to the right directory?

okos


All times are GMT -5. The time now is 04:42 PM.