Sponsored Content
Top Forums Shell Programming and Scripting Copying a directory structure with the latest versions of files Post 302351377 by Glyn_Mo on Tuesday 8th of September 2009 10:57:45 AM
Old 09-08-2009
Copying a directory structure with the latest versions of files

Hello

I have three directory structures for code releases.

Each directory structure looks like this:

bash-3.00$ ls -R | more

.:
Test_Release_1
Test_Release_2
Test_Release_3

./Test_Release_1/dbcode:

rp_online_import_srdp.pkb-1
srdp_ar_validation.pkb-1
srdp_rp_aclaim_detail_qry_pkg.pkb-1
srdp_rp_common_qry_pkg.pkb-1

./Test_Release_2/dbcode:

rp_online_import_srdp.pkb-2
srdp_ar_validation.pkb-2
srdp_rp_aclaim_detail_qry_pkg.pkb-2
srdp_rp_common_qry_pkg.pkb-2

./Test_Release_3/dbcode:

rp_online_import_srdp.pkb-3
srdp_ar_validation.pkb-3
srdp_rp_aclaim_detail_qry_pkg.pkb-3
srdp_rp_common_qry_pkg.pkb-3

What I'm wanting to do is, is to create a composite directory called "Test_Releases_1-3" which will have the same structure (with a dbcode directory), but will only copy scripts with the highest version number into the dbcode folder of the new composite directory "Test_Releases_1-3". In the new composite release structure I only want to get the very latest versions of scripts. The code release directories often contain multiple versions of the same package.

I'm needing to write a script which will create the composite release directory automatically, only extracting the latest version of packages from the original release directories.

Hope that made some sort of sense.

Thanks in advance
Glyn
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies

2. UNIX for Dummies Questions & Answers

Copying files with the latest date

Hi All, I have a situation where I need to copy the files having the latest date. For example I have a file by name bas100e1_jun05. I need to copy it to bas100e1. But when a file by name bas100e1_jul05 is put in the same directory the script should copy the file having the latest month which... (34 Replies)
Discussion started by: shashi_kiran_v
34 Replies

3. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

4. UNIX for Dummies Questions & Answers

Copying with directory structure

Hi, I need to copy a set of directories along with all sub directories and files from one unix box to another. Any ideas? cnfsed (4 Replies)
Discussion started by: Cnfsed
4 Replies

5. Shell Programming and Scripting

redirection and copying with same directory structure

Dear Experts, How can I solve this problem ? I want to redirect with having the same directory structure as in my input. for temp in `find ./CSV/ -name "*.v"` do fname = `basename $temp` ./script.sh $temp > ./out/$fname done But my problem here is all the... (3 Replies)
Discussion started by: user_prady
3 Replies

6. UNIX for Dummies Questions & Answers

latest files copying over to new path

ls -lrt | nawk -v D="$(date +'%b%e:'| sed 's/ //g')" 'D==$6$7":"{sub(".*"$9,$9);print}' This picks only the latest files created based on the timestamp for that particular day.. how do i copy over the same files to a different location???? (1 Reply)
Discussion started by: win4luv
1 Replies

7. Shell Programming and Scripting

Copying files to new dir structure.

I am trying to figure out a way to script copying specific files from one dir structure to another. I have a dir structure like this: dira/author 1/book 1/file a.epub /book 2/file b.epub /author 2/book 1/file c.epub /author 3/book 1/file d.epub /book 2/file... (2 Replies)
Discussion started by: arcanas
2 Replies

8. Shell Programming and Scripting

Perl : copying only the latest file to other directory

In linux.. In a directory there are 3 files which I want to copy only the latest file (ls -ltr myfiles*.txt|tail -1) to other directory in perl? Could anyone please help me with the code? Regards, J (1 Reply)
Discussion started by: scriptscript
1 Replies

9. Shell Programming and Scripting

Help with korn shell script to get the latest file versions in a directory

I want to write a korn shell script to get the latest three versions for a file in the directory having lot of files with various versions (files with prefix as same but time stamp as suffix) and compress it and at the same time have to remove the remaining versions of the file (other than latest... (4 Replies)
Discussion started by: maheshbabu
4 Replies

10. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies
composite(3pm)						User Contributed Perl Documentation					    composite(3pm)

NAME
Tk::composite - Defining a new composite widget class SYNOPSIS
package Tk::MyNewWidget; use Tk:widgets qw/ list of Tk widgets /; use base qw/ Tk::Frame /; # or Tk::Toplevel Construct Tk::Widget 'MyNewWidget'; sub ClassInit { my( $class, $mw ) = @_; #... e.g., class bindings here ... $class->SUPER::ClassInit( $mw ); } sub Populate { my( $self, $args ) = @_; my $flag = delete $args->{-flag}; if( defined $flag ) { # handle -flag => xxx which can only be done at create # time the delete above ensures that new() does not try # and do $self->configure( -flag => xxx ); } $self->SUPER::Populate( $args ); $self = $self->Component( ... ); $self->Delegates( ... ); $self->ConfigSpecs( '-cursor' => [ SELF, 'cursor', 'Cursor', undef ], '-something' => [ METHOD, dbName, dbClass, default ], '-text' => [ $label, dbName, dbClass, default ], '-heading' => [ {-text => $head}, heading, Heading, 'My Heading' ], ); } sub something { my( $self, $value) = @_; if ( @_ > 1 ) { # set it } return # current value } 1; __END__ =head1 NAME Tk::Whatever - a whatever widget =head1 SYNOPSIS use Tk::Whatever; $widget = $parent->Whatever(...); =head1 DESCRIPTION ... DESCRIPTION
The intention behind a composite is to create a higher-level widget, sometimes called a "super-widget" or "mega-widget". Most often, a composite will be built upon other widgets by using them, as opposed to specializing on them. For example, the supplied composite widget LabEntry is made of an Entry and a Label; it is neither a kind-of Label nor is it a kind-of Entry. Most of the work of a composite widget consistd in creating subwidgets, arranging to dispatch configure options to the proper subwidgets and manage composite-specific configure options. GLORY DETAILS
Depending on your Perl/Tk knowledge this section may be enlighting or confusing. Composite Widget Since Perl/Tk is heavilly using an object-oriented approach, it is no suprise that creating a composite goes through a new() method. However, the composite does not normally define a new() method itself: it is usually sufficient to simply inherit it from Tk::Widget. This is what happens when the composite uses use base qw/ Tk::Frame /; # or Tk::Toplevel to specify its inheritance chain. To complete the initialisation of the widget, it must call the Construct method from class Widget. That method accepts the name of the new class to create, i.e. the package name of your composite widget: Construct Tk::Widget 'MyNewWidget'; Here, MyNewWidget is the package name (aka the widget's class). This will define a constructor method for MyNewWidget, normally named after the widget's class. Instanciating that composite in client code would the look like: $mw = MainWindow->new; # creates a top-level MainWindow $self = $mw->MyNewWidget(); # creates an instance of the # composite widget MyNewWidget Whenever a composite is instanciated in client code, "Tk::Widget::new()" will be invoked via the widget's class constructor. That new method will call $self->Populate(\%args); where %args is the arguments passed to the widget's constructor. Note that Populate receives a reference to the hash array containing all arguments. Populate is typically defined in the composite class (package), which creates the characteristic subwidgets of the class. Creating Subwidgets Subwidget creation happens usually in Populate(). The composite usually calls the subwidget's constructor method either directly, for "private" subwidgets, or indirectly through the Component method for subwidgets that should be advertised to clients. Populate may call Delegates to direct calls to methods of chosen subwidgets. For simple composites, typically most if not all methods are directed to a single subwidget - e.g. ScrListbox directs all methods to the core Listbox so that $composite->get(...) calls $listbox->get(...). Defining mega-widget options Populate should also call ConfigSpecs() to specify the way that configure-like options should be handled in the composite. Once Populate returns, method Tk::Frame::ConfigDefault walks through the ConfigSpecs entries and populates %$args hash with defaults for options from X resources (.Xdefaults, etc). When Populate returns to Tk::Widget::new(), a call to $self->configure(%$args) is made which sets *all* the options. SEE ALSO
Tk::ConfigSpecs Tk::mega Tk::Derived perl v5.14.2 2010-05-29 composite(3pm)
All times are GMT -4. The time now is 07:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy