![]() |
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 |
| Copying files from one directory to Other | satishkeshetty | UNIX for Dummies Questions & Answers | 3 | 04-14-2008 08:08 AM |
| shell script to selectively tar directory based on date | fara_aris | Shell Programming and Scripting | 2 | 03-16-2008 07:35 PM |
| Loop through files in dir, omit file with latest date | stringzz | Shell Programming and Scripting | 2 | 12-04-2007 02:04 PM |
| Copying file names returned from a grep command into another directory | Kartheg | UNIX for Dummies Questions & Answers | 4 | 11-17-2005 12:34 PM |
| can we list other than c files in a directory with only 'ls' command? | venkat | UNIX for Dummies Questions & Answers | 3 | 03-12-2004 09:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Using cp -r command to selectively omit *.dat files while copying a directory.
Hi all,
I want to copy a directory named Ec1 to another directory named Ec2, newly created. But Ec1 has a bunch of *.dat files and many many other kinds of files. Whle creating Ec2, I selectively want to omit the *.dat files since they are huge files of the order of 100 MBs and there are hundreds of such files which would consume a lot of time. How can I use the 'cp -r' command to selectively omit the *.dat files in Ec1 and obtain the Ec2 directory without any *.dat files while copying the directory Ec1. Any suggestions are appreciated. Thanks, Sai. |
|
||||
|
Thanks.
You are a genius reborg!
This is what I did, and it worked. cd Ec1/ find . -depth ! -name "*.dat" | cpio -pdmv ../Ec2 In the first part, I am guessing that you are finding all the files without a *.dat and then you are piping the output into Ec2. Just curious, what do the cpio and -pdmv do? Thanks a lot, Sai. |
|
||||
|
Hi It was very excellent .... made my job easy.
I have another question .... Dir1 I have some files *.dat Dir2 I have script to run .... I would like to pass the all *.dat files to the script in dir2 without path ( only the file names) ... can anyone help me in this Thanks in advance Madan |
![]() |
| Bookmarks |
| Tags |
| cpio |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|