LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-06-2008, 02:28 AM   #1
CheeSen
LQ Newbie
 
Registered: Sep 2008
Posts: 14

Rep: Reputation: Disabled
Help bash programming


For an example :

i am in the dir1, i want to copy the files in dir1 to dir2
what is the command ?
when i typed cp file dir3
it just coppied 1 more file name dir3 only.
but i want to copy to directory dir3 .
anyone help me?
 
Old 09-06-2008, 02:37 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
It depends - do you need a recursive copy or just direct?

Normal copy - will not copy subdirectories, and symlinks are resolved (actual files copied):
cp dir1/* dir3/

Recursive copy - will copy subdirectories, symlinks, special files:
cp -a dir1/* dir3/
 
Old 09-06-2008, 02:42 AM   #3
CheeSen
LQ Newbie
 
Registered: Sep 2008
Posts: 14

Original Poster
Rep: Reputation: Disabled
but now i am inside the dir1 ? do i must cd .. go out only can use that command ? if i want to use the copy command inside dir1? any idea?
 
Old 09-07-2008, 05:40 AM   #4
lipun4u
Member
 
Registered: Sep 2008
Location: Mumbai, india
Distribution: ubuntu and hp-unix
Posts: 118

Rep: Reputation: 15
use cp -a * /dir command

u can also give the absolute path of your current directory...
 
Old 09-07-2008, 09:14 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
CheeSen;

This is the third thread you have started on basically the same topic. In the other two, you did not follow-up on the last help offered.

Please keep related questions in one thread, and follow-up on the help you get before posting a new thread.

reported for closure
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash programming winterhunter Linux - Newbie 6 11-26-2007 07:14 AM
Bash Programming moodupani Programming 1 08-31-2005 06:50 PM
bash programming alaios Programming 2 07-23-2005 12:52 AM
bash programming drisay Programming 6 12-20-2004 09:09 AM
bash programming cpukiller Linux - Newbie 1 11-04-2003 06:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:24 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