LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-25-2008, 09:10 PM   #1
NevadaSam
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Rep: Reputation: 0
Copying folder content and not folder


I want to copy the contents of the folder named "mozilla_BACKUP", but what I am using copies the whole folder. I tried to indicate file by using *.* but I guess that is just for DOS.

cp -a /home/sam/Desktop/mozilla_BACKUP /home/sam/.mozilla
 
Old 11-25-2008, 09:16 PM   #2
centos82
Member
 
Registered: Sep 2008
Distribution: CentOS
Posts: 75

Rep: Reputation: 16
cp -R /home/sam/Desktop/mozilla_BACKUP/* /home/sam/.mozilla
 
Old 11-25-2008, 09:52 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by NevadaSam View Post
I want to copy the contents of the folder named "mozilla_BACKUP", but what I am using copies the whole folder. I tried to indicate file by using *.* but I guess that is just for DOS.

cp -a /home/sam/Desktop/mozilla_BACKUP /home/sam/.mozilla
Using a single asterisk as someone else pointed is the way to go.

In linux, "*.*" will only match files that have a dot on their name.
 
Old 11-26-2008, 07:47 AM   #4
NevadaSam
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the reply. I also see that you replaced the -a with -R

Thanks
 
Old 11-26-2008, 07:58 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Take a look at man cp: the -a option is the same as -dpR, that is recursive mode plus preserve links (-d) and preserve mode, ownership, timestamp (-p). You can use -a instead of -R as well.
 
  


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
How can I rename a folder's content to the name of the folder itself? xmrkite Linux - Software 7 07-25-2008 12:28 PM
Making the content of two folders appear in one folder. E71 Linux - Newbie 1 10-28-2007 11:59 AM
copy content of the folder ashley75 Linux - General 6 04-16-2007 10:50 AM
ls content of a folder lonecrow Linux - Newbie 2 09-28-2006 06:12 PM
Deleting folder content Azhrarn Linux - Software 4 04-27-2006 04:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:55 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
Open Source Consulting | Domain Registration