Using treaters for the first time. How move file to other Directory

32 Views Asked by At

I have created two directories [Dir1] and [Dir2] and inside [Dir1], I have created a file called impFile.

Now, From where I ended up, I want to move impFile that is in Dir1 into Dir2. I tried this

" mv /Dir1/impFile.txt /Dir2/impFile.txt

but it doesnt work.

Can anybody tell me what I can do to make this work.


[ec2-user@ip-178-31-8-98 ~]$ mkdir Dir1
[ec2-user@ip-178-31-8-98 ~]$ mkdir Dir2
[ec2-user@ip-178-31-8-98 ~]$ cd /home/ec2-user/Dir1

[ec2-user@ip-178-31-8-98 Dir1]$ echo hi > impFile.txt

[ec2-user@ip-178-31-8-98 Dir1]$ cd
[ec2-user@ip-178-31-8-98 ~]$
[ec2-user@ip-178-31-8-98 ~]$ pwd
/home/ec2-user

[ec2-user@ip-172-31-8-94 ~]$  <-- WHERE I ENDED UP
1

There are 1 best solutions below

0
pluckplk On

If I'm not wrong,

"/" = root of the system. Instead, you wish to call move from your current folder, so the mv command should look like :

mv ./Dir1/impFile.txt ./Dir2/

"." means "actual position"

it is the same as doing :

mv /home/ec2-user/Dir1/impFile.txt /home/ec2-user/Dir2/

Quick edit : mv = target (file) to destination (folder)