LinuxQuestions.org
Review your favorite Linux distribution.
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 01-09-2004, 01:58 PM   #1
ashley75
Member
 
Registered: Aug 2003
Posts: 232

Rep: Reputation: 30
copy content of the folder


sorry, this question may be too easy for many gurus in here but I need help:


1. how can I copy all of the folder named A to the folder B????
cp -R A B???


2. on vi, how can I replace a word to something else, also replace all???

thanks
 
Old 01-09-2004, 02:05 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
1) Copy:
cp -r /path/to/A /path/to/B

2) Open the document in vi then type:
:%s/word/something/eg
 
Old 01-09-2004, 02:07 PM   #3
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
Quote:
−R, −r, −−recursive
copy directories recursively
from cp man page ... it will copy the whole directory tree, subdirectorys and all...
so ---> cp -r /here /to/here

as of vi ....

:%s/the/The/gc
replace the with The but will ask before substituting.

:1,$s/the/The/g
will search the entire file and replace the with The.

Last edited by DrOzz; 01-09-2004 at 02:08 PM.
 
Old 01-09-2004, 02:12 PM   #4
ashley75
Member
 
Registered: Aug 2003
Posts: 232

Original Poster
Rep: Reputation: 30
If I use:

cp -r /path/to/A /path/to/B

later on the B directory I am going to have:

/path/to/B/A/.............

I don't want to have the A folder on B:

I just want something like

/path/to/B/whatever the content in A directory.

thanks
 
Old 01-09-2004, 02:59 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
How about using cpio?

cd /DirectoryA
find . -depth | cpio --pass-through \
--preserve-modification-time \
--make-directories --verbose /DirectoryB
 
Old 04-16-2007, 11:43 AM   #6
re007
LQ Newbie
 
Registered: Apr 2007
Distribution: slackware
Posts: 6

Rep: Reputation: 0
copy content from dir to another dir

being in the dir that you want to copy the content type : cp -rui /source path/* /destination path

cp=copy
-r=recursive (also copies all the sub dir's)
-u=updates any older files newer are being left alone
-i=prompt when overrides
*=wildcard (for files with extensions that would be *.*

being sort of a dead subject i hope i could be of help
 
Old 04-16-2007, 11:50 AM   #7
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by ashley75
If I use:

cp -r /path/to/A /path/to/B

later on the B directory I am going to have:

/path/to/B/A/.............
Try:
Code:
cp -r /path/to/A/* /path/to/B/
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
copy content between 2 web sites jim656 Linux - Networking 5 11-08-2005 11:11 AM
How to copy the content of a DVD into several CDs? anindyanuri Linux - Software 2 06-13-2005 09:05 AM
copy a content of screen while X windows system is being loaded fuelinux Linux - Newbie 2 10-24-2003 07:36 AM
how do i copy a folder to a newly installed hd dsiguy Linux - General 2 09-24-2003 02:25 PM
How to copy a selected content from a .PDF file satimis Linux - General 3 07-03-2003 05:18 AM

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

All times are GMT -5. The time now is 03:39 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration