Sponsored Content
Top Forums Shell Programming and Scripting Search for specific file type in subdirectory with multiple folders Post 302981812 by RavinderSingh13 on Monday 19th of September 2016 11:40:01 PM
Old 09-20-2016
Quote:
Originally Posted by cmccabe
set -x showed that, while I am still not sure of the best way to accomplish this, the final vcf.gz that comes from the 001 folder is called variants.vcf.gz. The final vcf.gz that comes from the 002 folder is also called variants.vcf.gz. So unless the files are named differently somehow they are always going to be replaced. Thank you Smilie.
Hello cmccabe,

I am sorry, I am confused about your requirement. But by seeing your findcommand I could say you need to copy few files by finding them from one location to another and copy to detination directory, so you could try to change your command with following(not tested though).
Code:
find $a/$line -name "*vcf.gz" -exec cp -t $DEST {} \+

It will copy all matched files to destination directory. Please try it and do let us know how it goes then. If your requirement is different then please be more clear and specific in your requirements.

Thanks,
R. Singh

Last edited by RavinderSingh13; 09-20-2016 at 05:38 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

string search in folders with particular multiple file extension

Hi, I am newbie in UNIX so please excuse for my questions. Is there a a way to search for string in files within folder and sub folder in particluar file extensions. Ex. search for ABC in folder 'A'(including it's sub folders) in html, xml files. Thanks, Ani (2 Replies)
Discussion started by: anikanch
2 Replies

2. Shell Programming and Scripting

Search for multiple strings in specific position

Hi, I need to search for some strings in specific positions in a file. If the strings: "foo1", "foo2" or "foo3" is on position 266 or position 288 in a file i want the whole line printed. Any idea how to do it? (5 Replies)
Discussion started by: HugoH
5 Replies

3. Shell Programming and Scripting

Find files of specific size excluding search in a subdirectory

Hi All, I was exploring find command and came across -prune option which would exclude search in a mention subdirectory. My quesry is to search all files more that 100 MB size but exclude search in a subdirectory. I am using below command,but somehow it is not working. Can anybody help me... (6 Replies)
Discussion started by: usha rao
6 Replies

4. Shell Programming and Scripting

Find files of type within folder copy multiple results to different folders

Ok question number two: I'd like to search a directory for multiple file types (rar, txt, deb) and depending on what's found, copy those files to folders named Rar, TextFiles, and Debs. I'm looking for speed here so the faster the script the better. I want it to be a function that I pass 1 argument... (4 Replies)
Discussion started by: DC Slick
4 Replies

5. Shell Programming and Scripting

Search for file and size subdirectory as well

Hi I made this code to search in directory for file and size How can I remodel it to seach in the sub direcotry as well Thanks #!/bin/bash echo -n "Enter: " read var if then echo "Directory exists: ${var}" size=`du -hs "${var}"` echo The size of the current folder is... (4 Replies)
Discussion started by: lio123
4 Replies

6. Shell Programming and Scripting

Script to search specific folders dates /mm/dd/ structure

Hi, I have a script that handles a huge amount of log files from many machines and copies it into a SAN location with the following directory structure: /SAN/machinenames/yyyy/m/d so for example /SAN/hosta/2011/3/12/files* Now I am writing a bash script to search for files between to date... (4 Replies)
Discussion started by: GermanJulian
4 Replies

7. Shell Programming and Scripting

how to count how many subdirectory containing more than a certain number of specific file type

hi I want to write a script which count the number of subdirectories in the current root directory that contain more than a specified number of files of a specific type. Is there an easy way to do this? Thanks Robert (2 Replies)
Discussion started by: piynik
2 Replies

8. Shell Programming and Scripting

Gunzip,grep and zip across folders in a subdirectory

I have a simple function that greps within a folder into files that are already gunzipped. This was already written for me so from my understanding fn=$1 specifies that it will look into any file in that folder that is gunzipped and the rest of the script greps the data its looking for and puts it... (3 Replies)
Discussion started by: red56
3 Replies

9. Shell Programming and Scripting

Copying specific file types to specific folders

I am trying to write a script that cycles through a folder containing many folders and when inside each one it's supposed to copy all the .fna.gz files to a folder elsewhere if the file and the respective folder have the same name. for fldr in /home/playground/genomes/* ; do find .... (8 Replies)
Discussion started by: Mr_Keystrokes
8 Replies

10. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies
Text::vCard::Addressbook(3pm)				User Contributed Perl Documentation			     Text::vCard::Addressbook(3pm)

NAME
Text::vCard::Addressbook - a package to parse, edit and create multiple vCards (RFC 2426) SYNOPSIS
use Text::vCard::Addressbook; my $address_book = Text::vCard::Addressbook->new({ 'source_file' => '/path/to/address.vcf', }); foreach my $vcard ($address_book->vcards()) { print "Got card for " . $vcard->fullname() . " "; } DESCRIPTION
This package provides an API to reading / editing and creating multiple vCards. A vCard is an electronic business card. This package has been developed based on rfc2426. You will find that many applications (Apple Address book, MS Outlook, Evolution etc) can export and import vCards. READING IN VCARDS
load() use Text::vCard::Addressbook; # Read in from a list of files my $address_book = Text::vCard::Addressbook->load( ['foo.vCard', 'Addresses.vcf']); This method will croak if it is unable to read in any of the files. import_data() $address_book->import_data($value); This method imports data directly from a string. new() # Read in from just one file my $address_book = Text::vCard::Addressbook->new({ 'source_file' => '/path/to/address.vcf', }); This method will croak if it is unable to read in the source_file. # File already in a string my $address_book = Text::vCard::Addressbook->new({ 'source_text' => $source_text, }); # Create a new address book my $address_book = Text::vCard::Addressbook->new(); Looping through all vcards in an address book. foreach my $vcard ($address_book->vcards()) { $vcard->...; } METHODS
add_vcard() my $vcard = $address_book->add_vcard(); This method creates a new empty Text::vCard object, stores it in the address book and return it so you can add data to it. vcards() my $vcards = $address_book->vcards(); my @vcards = $address_book->vcards(); This method returns a reference to an array or an array of vcards in this address book. This could be an empty list if there are no entries in the address book. set_encoding() $address_book->add_vcard('utf-8'); This method will add the string ';charset=utf-8' to each and every vCard entry. That does help in connection with e.g. an iPhone... export() my $vcf_file = $address_book->export() This method returns the vcard data in the vcf file format. Please note there is no validation, you must ensure that the correct nodes (FN,N,VERSION) are already added to each vcard if you want to comply with RFC 2426. This might not escape the results correctly at the moment. AUTHOR
Leo Lapworth, LLAP@cuckoo.org COPYRIGHT
Copyright (c) 2003 Leo Lapworth. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ACKNOWLEDGEMENTS
The authors of Text::vFile::asData for making my life so much easier. SEE ALSO
Text::vCard, Text::vCard::Node perl v5.10.1 2011-01-11 Text::vCard::Addressbook(3pm)
All times are GMT -4. The time now is 11:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy