Copying the files after filter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copying the files after filter
# 8  
Old 03-06-2013
Try:
Code:
find . -name "*.images" -o -name "*.htm" -exec cp -R {} /home/oracle \;

# 9  
Old 03-06-2013
@panyam and @CarloM, i tried both command not working.
coping only .htm file and not copied .images directories...
# 10  
Old 03-06-2013
Sorry, I missed a grouping:
Code:
find . \( -name "*.images" -o -name "*.htm" \) -exec cp -R {} /home/oracle \;

# 11  
Old 03-06-2013
Still i am facing same issue.. Let me explain again...


Code:
  ls -ltr 
drwxr-xr-x 2 oracle dba  4096 Mar  6 16:52 test_4680.images
drwxr-xr-x 2 oracle dba  4096 Mar  6 16:52 index_4697.images
drwxr-xr-x 2 oracle dba  4096 Mar  6 16:52 test_4698.images
drwxr-xr-x 2 oracle dba  4096 Mar  6 16:52 test_4699.images
drwxr-xr-x 2 oracle dba  4096 Mar  6 16:52 test_4701.images
-rw-r--r-- 1 oracle dba  7203 Mar  5 15:42 test_2389.htm
-rw-r--r-- 1 oracle dba  6691 Mar  5 15:42 test_2312.htm
-rw-r--r-- 1 oracle dba  8355 Mar  5 15:42 test_2205.htm
-rw-r--r-- 1 oracle dba  7435 Mar  5 15:42 test_2187.htm
-rw-r--r-- 1 oracle dba  7424 Mar  5 15:42 test_1327.htm
-rw-r--r-- 1 oracle dba  7424 Mar  5 15:42 test_1328.txt
-rw-r--r-- 1 oracle dba  7424 Mar  5 15:42 test_1328.doc

i want filter only .images directory and .htm files?

---------- Post updated at 08:28 AM ---------- Previous update was at 08:25 AM ----------

Really sorry.. i didn't notice those files... it's working all ...
Thanks lot guys. ROCK
# 12  
Old 03-06-2013
At least this worked for me :

Code:
 for fil in `ls -lrt | awk '{ print $NF}'  | egrep ".images|.html"`; 
 do 
 cp -R $fil /home/oracle
 done

This User Gave Thanks to panyam For This Post:
# 13  
Old 03-07-2013
@panyam,Great...............
# 14  
Old 03-07-2013
That is useless use of ls

Using bash built-ins:
Code:
for file in *.{images,html}
do
   cp -R "$file" /home/oracle/
done

This User Gave Thanks to Yoda For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter using awk in CSV files

Hello Gentlemen, Finding difficulties to play with my Input files:confused: . Your guidance will certainly help as always. After converting to csv file from XLSM file, I am getting some extra ""(double quote) characters which I want to terminate inside shell script and process it further. ... (6 Replies)
Discussion started by: pradyumnajpn10
6 Replies

2. UNIX for Dummies Questions & Answers

Filter and merge 2 files problem

Hi, I'm trying to combine two files which have 1 column in common and filter out rows I don't need. File 1: ID Start End Matched Coverage 1 1 254 1515 5.96 2 1 135 402 2.98 File 2 (has 2 rows per entry): >1... (4 Replies)
Discussion started by: Yarinka
4 Replies

3. UNIX for Dummies Questions & Answers

Filter lines common in two files

Thanks everyone. I got that problem solved. I require one more help here. (Yes, UNIX definitely seems to be fun and useful, and I WILL eventually learn it for myself. But I am now on a different project and don't really have time to go through all the basics. So, I will really appreciate some... (6 Replies)
Discussion started by: latsyrc
6 Replies

4. Shell Programming and Scripting

how to filter files with given format

Hi, all, I have files like: nameserver 216.66.22.2 ; tserv1.ash1.ipv6.he.net. tserv13.ash1.ipv6.he.net. nameserver 216.66.38.58 ; tserv1.tor1.ipv6.he.net. tserv21.tor1.ipv6.he.net. nameserver 216.218.221.6 ;... (3 Replies)
Discussion started by: esolvepolito
3 Replies

5. Shell Programming and Scripting

Files copying - [ Listed files alone. ] - Shell script

Hi All, I am doing this for svn patch making. I got the list of files to make the patch. I have the list in a file with path of all the files. To Do From Directory : /myproject/MainDir To Directory : /myproject/data List of files need to copy is in the file: /myproject/filesList.txt ... (4 Replies)
Discussion started by: linuxadmin
4 Replies

6. UNIX for Dummies Questions & Answers

Search and filter between two files

Hello, I have two files in this form that consist of three columns, a name (L*contig*), the length (length=**) and the sequence LT_file.txt LTcontig1 length=13 acccatgctttta LTcontig5 length=8 ggattacc LTcontig8 length=20 ccattgaccgtacctgatcg LTcontig23 length=5 accta and... (5 Replies)
Discussion started by: FelipeAd
5 Replies

7. Shell Programming and Scripting

Filter files and print

Hi, I need to filter and store the files ends with log extension in the array and need to write the file names in the array to a file. I need to use array to derive this solution. Please help me out. Thanks (2 Replies)
Discussion started by: Sekar1
2 Replies

8. Shell Programming and Scripting

Copying a files from a filter list and creating their associated parent directories

Hello all, I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have... (4 Replies)
Discussion started by: hunter55
4 Replies

9. Shell Programming and Scripting

Filter only gz files from list of subdirectories

Hi, I have a very big directory structure that consists of many sub-directories inside.There are around 50 ".gz" files under this dir structure. I want to copy all the gz files alone to a seperate location. Plz help me. (2 Replies)
Discussion started by: villain41
2 Replies

10. UNIX for Advanced & Expert Users

copying of files by userB, dir & files owned by userA

I am userB and have a dir /temp1 This dir is owned by me. How do I recursively copy files from another users's dir userA? I need to preserve the original user who created files, original group information, original create date, mod date etc. I tried cp -pr /home/userA/* . ... (2 Replies)
Discussion started by: Hangman2
2 Replies
Login or Register to Ask a Question