Copying a directory structure with the latest versions of files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copying a directory structure with the latest versions of files
# 1  
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
# 2  
Old 09-08-2009
I am not clear with the requirement.
what are the version number? are those which are mentioned at the end of the file names?

It will be better if you list the files from the above example which you want to copy in the new directory.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question