LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   extracting root folder to a user home folder command (https://www.linuxquestions.org/questions/linux-newbie-8/extracting-root-folder-to-a-user-home-folder-command-4175546114/)

mzein1292 06-22-2015 02:54 PM

extracting root folder to a user home folder command
 
I mounted a folder inside my C drive to a root path of mnt/myFolder

now I am trying to copy the contents of that folder to /home/dev/build/mysource

I used that command that was taught by my senior inside the folder that I want to copy but it is not working as the error I am getting is

Code:

-bash: syntax error near unexpected token `('
can you please help me understand why this is happening ?

this is my command:

Code:

tar cvf - * : (cd /home/dev/build/mysource; tar xf -)
Thank you

jdkaye 06-22-2015 03:00 PM

Quote:

I mounted a folder inside my C drive to a root path of mnt/myFolder
Sorry but I don't understand what a "C drive" is. What distro are you using?
jdk

suicidaleggroll 06-22-2015 03:13 PM

Quote:

Originally Posted by mzein1292 (Post 5381247)
this is my command:

Code:

tar cvf - * : (cd /home/dev/build/mysource; tar xf -)

That is not a valid Linux command. If you just want to copy a directory, then use cp -r, eg:
Code:

cp -r /mnt/myFolder /home/dev/build/mysource

sgrlscz 06-23-2015 07:26 AM

Quote:

Originally Posted by mzein1292 (Post 5381247)
this is my command:

Code:

tar cvf - * : (cd /home/dev/build/mysource; tar xf -)
Thank you

Change the ':' to a '|'. You want to create a pipe from the first tar to the second.

Also, the * will miss any hidden files, but . will copy everything.

Code:

tar cvf - . | (cd /home/dev/build/mysource; tar xf -)


All times are GMT -5. The time now is 05:07 PM.