LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Thread Tools
Old 03-20-2009, 09:31 PM   #1
Paris Heng
Member
 
Registered: Jul 2007
Location: Kuala Lumpur, Malaysia
Distribution: Ubuntu 8.04, Solaris 10
Posts: 198
Thanked: 0
Copy Dir


[Log in to get rid of this advertisement]
Any different between the following two commands? One with *, one with no *. Which one will be the best to copy "whole" directory to include everything?

Quote:
cp -r present/directory/ /desire/derectory
cp -r present/directory/* /desire/derectory
Paris Heng is offline     Reply With Quote
Old 03-20-2009, 10:25 PM   #2
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 10
Posts: 284
Thanked: 12
Okay doing
cp -r present/directory/ /desire/directory
is going to copy "directory" -- including it's contents -- to /desire/ whereas
cp -r present/directory/* /desire/directory
is going to copy the CONTENTS only of "directory" to /desire/directory, assuming the directory /desire/directory exists. If /desire/directory does not exist the command will return an error to that effect and you will first have to manually create the directory.
SharpyWarpy is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
Why cannot copy from mnt/cdron to my RH8 dir? mikelancey Linux - Newbie 7 06-06-2008 12:00 AM
Copy files in subdirs to one dir Rotwang Linux - General 4 12-14-2007 02:30 PM
How can I copy an entire CD (from WinXP) to a dir on my Linux server? hmendoza Linux - General 2 04-04-2007 07:06 PM
how copy from floppy to dir? cauge Mandriva 6 12-09-2003 12:12 PM
copy 1 file to multiple dir script carpman Linux - General 14 02-07-2002 10:29 AM


All times are GMT -5. The time now is 11:48 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration