LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2015, 02:54 PM   #1
mzein1292
LQ Newbie
 
Registered: Jun 2015
Posts: 1

Rep: Reputation: Disabled
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
 
Old 06-22-2015, 03:00 PM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
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
 
Old 06-22-2015, 03:13 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,464

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Quote:
Originally Posted by mzein1292 View Post
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
 
Old 06-23-2015, 07:26 AM   #4
sgrlscz
Member
 
Registered: Aug 2008
Posts: 62

Rep: Reputation: 31
Quote:
Originally Posted by mzein1292 View Post
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 -)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to make a link (user)folder that links to a root folder morganfreeman Linux - Server 6 01-14-2013 05:56 AM
[SOLVED] Not able to create folder in home dir as root user vedaprasad Linux - Newbie 5 04-17-2012 04:34 AM
[SOLVED] Seperating Home folder from Root Folder to a new partition. baxzius Linux - Newbie 5 08-01-2011 03:26 PM
I can not open the user folder in home and write in a shared folder jorge_ivan Linux - General 8 08-02-2006 11:28 AM
permissions difference between /home/..../folder and /root/folder darkleaf Linux - General 3 07-21-2005 05:23 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration