![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Copy files from a directory by ftp | hippa77 | UNIX for Dummies Questions & Answers | 3 | 10-06-2007 02:26 PM |
| find files and copy into a directory | balireddy_77 | Shell Programming and Scripting | 4 | 04-27-2007 03:38 AM |
| Copy files from CDROM to DOS Directory | greystoke | UNIX for Dummies Questions & Answers | 3 | 01-24-2007 01:12 PM |
| Copy files from one directory to another | HAA | Shell Programming and Scripting | 1 | 07-06-2006 02:47 AM |
| Copy files from one directory to another | hd2006 | Shell Programming and Scripting | 0 | 06-07-2006 02:29 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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 |
|
||||
|
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/ |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|