![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Copy files from a directory by ftp | hippa77 | UNIX for Dummies Questions & Answers | 3 | 10-06-2007 11:26 AM |
| find files and copy into a directory | balireddy_77 | Shell Programming and Scripting | 4 | 04-27-2007 12:38 AM |
| Copy files from CDROM to DOS Directory | greystoke | UNIX for Dummies Questions & Answers | 3 | 01-24-2007 09:12 AM |
| Copy files from one directory to another | HAA | Shell Programming and Scripting | 1 | 07-05-2006 11:47 PM |
| Copy files from one directory to another | hd2006 | Shell Programming and Scripting | 0 | 06-07-2006 11:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
how do i copy files from one directory to another directory using a while loop? (like jus say i had a.doc and b.doc in one directory and i want to copy it into another)
i used a if statement but doesn't work |
| Forum Sponsor | ||
|
|
|
|||
|
cbkihong's example will work to copy entire directorys over. that seems like what you were asking. the -r flag for the cp command tells cp to copy directories recursivley.
coping individual files works the same way, just without the -r flag. eg: cp file1 somewhere/file1 |
|
|||
|
The -f test doesn't accept multiple arguments. *.src is expanded by the shell to all matching filenames, so there are multiple arguments. As being said, from your description you don't even need an "if" to do it. It's as simple as
cp *.src dir_b/ |