LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux 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
 
LinkBack Search this Thread
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

Rep: Reputation: 30
Copy Dir


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
 
Old 03-20-2009, 10:25 PM   #2
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 14 x_64
Posts: 456

Rep: Reputation: 47
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.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 08:19 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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration