
copy failed
saiganesh@LAPTOP-EJBON1NM ~
$ mkdir gp
saiganesh@LAPTOP-EJBON1NM ~
$ cp * gp/
[b]cp: -r not specified; omitting directory 'gp'[/b]
saiganesh@LAPTOP-EJBON1NM ~
$ cd gp
saiganesh@LAPTOP-EJBON1NM ~/gp
why i am geting above error while copying all files to gp directory? please advisei want to try rm and rmdir also
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.

ASKER
sh-4.4$ pwd
/home/cg/root
sh-4.4$ cat file1.txt
cat: file1.txt: No such file or directory
sh-4.4$ touch f1.txt
sh-4.4$ ls -ltr
total 4
-rw-r--r-- 1 25335 25335 978 Jan 29 18:52 README.txt
-rw-r--r-- 1 25335 25335 0 Jan 29 18:53 f1.txt
sh-4.4$ mkdir gp
sh-4.4$ ls -ltr
total 8
-rw-r--r-- 1 25335 25335 978 Jan 29 18:52 README.txt
-rw-r--r-- 1 25335 25335 0 Jan 29 18:53 f1.txt
drwxr-xr-x 2 25335 25335 4096 Jan 29 18:53 gp
sh-4.4$ mv gp /home/cg/root_destination
sh-4.4$ pwd
/home/cg/root
sh-4.4$ ls -ltr
total 4
-rw-r--r-- 1 25335 25335 978 Jan 29 18:52 README.txt
-rw-r--r-- 1 25335 25335 0 Jan 29 18:53 f1.txt
sh-4.4$ cd /home/cg/root_destination
sh-4.4$ ls -ltr
total 0
sh-4.4$ pwd
/home/cg/root_destination
sh-4.4$ ls -ltr
total 0
not sure why mv command did not work
please advise

ASKER
$ cd chap1i am trying above from below but not successful yet
$ ls -F
ex1.c ex2.c ex3.c example/ exercise/
$ mv * chap2/
https://www.thegeekstuff.com/2010/12/mv-command-examples/
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.

ASKER
Your move command worked as expected. This was your command:
mv gp /home/cg/root_destination
Explanation:
- gp is a directory
- /home/cg is a directory
The mv command moves the gp directory to the /home/cg directory.
Because you are specifying a destination named root_destination the mv command is renaming your gp directory to root_destination
And because your gp directory was empty, the ls -ltr is showing 0 files - the next pwd command is also showing correct output.
not clear.
can you please advise with any simple example?
Open in new window
To remove a directory and its contents use
Open in new window
To remove a file use
Open in new window