Needed script to generate versions for a file and maintian them in a folder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Needed script to generate versions for a file and maintian them in a folder
# 1  
Old 12-17-2012
Needed script to generate versions for a file and maintian them in a folder

need a shell script for the following requirement

how to generate 5 versions of a file in a folder

after generating them in a folder i want to maintian the past 2 versions of the file in the folder and i have to delete the the remaining.

for example if i ran the script today and tommorow it wil generate two 5 versions of the file in the folder,if i ran the same script day after tommorw then the folder should contain the present ,past versions of the file..
# 2  
Old 12-17-2012
This is no script drive-in. What did you try so far?
# 3  
Old 12-17-2012
i have three 5 version files in the folder as follows
Code:
testing_15122012.txt
testing_15122012.txt
testing_15122012.txt
testing_15122012.txt
testing_15122012.txt
testing_16122012.txt
testing_16122012.txt
testing_16122012.txt
testing_16122012.txt
testing_16122012.txt
testing_17122012.txt
testing_17122012.txt
testing_17122012.txt
testing_17122012.txt
testing_17122012.txt

i want the output as
Code:
testing_16122012.txt
testing_16122012.txt
testing_16122012.txt
testing_16122012.txt
testing_16122012.txt
testing_17122012.txt
testing_17122012.txt
testing_17122012.txt
testing_17122012.txt
testing_17122012.txt

the output should contain the present and last past version of the files...
the deletion should be done based on date and timestamp (as it should store the present and past one version of the files..)

Moderator's Comments:
Mod Comment Use code tags, thanks. See PM.

Last edited by zaxxon; 12-17-2012 at 08:46 AM.. Reason: modification in question..
# 4  
Old 12-17-2012
You still did not show what you have tried so far. Also use code tags please.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to generate csv file

Dears, I am new in shell world and I need your help in this, I have to create a report based on the output file generated by another program. I want to write a shell script for this. The output file generated every 15 minutes but i can’t open it until the end of day so the script will get the... (3 Replies)
Discussion started by: abdul2020
3 Replies

2. UNIX for Dummies Questions & Answers

Need script to generate file.

Hi I have a file "test" with data as below 1,APRIL,NEW,"New market,delhi,pune,India",RECENT, 254664 2,MARCH,OLD,"New Area,Mumbai,UP,India",CURRENT, 152483 So I want a script which provides output as below 1,APRIL,RECENT,254664 2,MARCH,CURRENT,152483 I am aware we can use awk/sed... (9 Replies)
Discussion started by: sv0081493
9 Replies

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

4. Shell Programming and Scripting

Needed script to FTP a File and generate a quality checksum file

hi all i want a script to FTP a file and should generate a quality checksum file means when I FTP a file from one server to another server it should generate a QC file which should contain timestamp,no.of records in that file Thanks in advance saikumar (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

5. Shell Programming and Scripting

Script to maintain file versions

I am developing a script to maintain 'n' number of versions of a file. The script will take a filename as a parameter and the number of versions to maintain. This basically does something like a FIFO. Here is what I developed. But something is not right. I have attached the script. Can u pls help... (2 Replies)
Discussion started by: vskr72
2 Replies

6. UNIX for Dummies Questions & Answers

Help needed, linking to file in different sub-folder

Hello, I'd really like some help on this, a PERL-CGI script (complete working script is below). How can I add the server's root folder (folder_f) to this: ~ s/_e\.shtml/_f\.shtml/ This bit of code searches all occurences of _e.shtml and replaces them with _f.shtml (it being in the same... (1 Reply)
Discussion started by: fredfletcher
1 Replies

7. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

8. Shell Programming and Scripting

How to generate nested folder permissions

Hi expert, I would like to know how to generate file and folder ( including nested subfolder and files) permissions under oracle directory ? (8 Replies)
Discussion started by: skully
8 Replies
Login or Register to Ask a Question