LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 03-20-2009, 08: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, 09:25 PM   #2
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Rep: Reputation: 91
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



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 On
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-05-2008 11:00 PM
Copy files in subdirs to one dir Rotwang Linux - General 4 12-14-2007 01: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 06:06 PM
how copy from floppy to dir? cauge Mandriva 6 12-09-2003 11:12 AM
copy 1 file to multiple dir script carpman Linux - General 14 02-07-2002 09:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:06 AM.

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