Sponsored Content
Top Forums Shell Programming and Scripting Adding Previous Month To Filename Post 302672201 by pravin27 on Monday 16th of July 2012 05:25:13 AM
Old 07-16-2012
Use below command instead of your mv.
Code:
mv Amount.zip Amount_$lmonth_$year.zip

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

file name using previous month

This has probably been asked 100 times, but I couldn't find any articles on point. I have a script that runs on the last day of every month at 11:30pm. If cats a number of input tables that were created the previous month (or earlier), combines them into one master file and erases the indivual... (1 Reply)
Discussion started by: beilstwh
1 Replies

2. Shell Programming and Scripting

How to get previous month files

Hi, My task to to delete files which are of previous months. I have files named as follows *CCYYMMDD.xls. on a particular day i have delete previous months files i.e in Dec i have delete all nov files which look like 200511DD.XLS in Jan i have to delete all Dec files 200512DD.xls ... (7 Replies)
Discussion started by: savitha
7 Replies

3. Shell Programming and Scripting

last working day of previous month

Hi, I want a script(ksh) to see if today is the last working day(Mon-Fri) of the month. If it is the last working day I need to print current date, else I need the last working day of previous month. Thanks in advance. (1 Reply)
Discussion started by: rspk_praveen
1 Replies

4. Shell Programming and Scripting

Help, I need to get the last date of previous month

Hi, I'm new with Unix, I'm trying to get a last day of previous month with this format: %b %d %Y (example: Feb 25 2008). Here is what I have so far. #!/bin/ksh cur_month=`date +%m` cur_year=`date +%Y` prev_month=$(($cur_month-1)) # Check to see if this is January if then ... (11 Replies)
Discussion started by: sirrtuan
11 Replies

5. UNIX for Dummies Questions & Answers

How to get the previous month by using `date`

Hello, I'm new to shell scripting. We've develop a script which will grep a file on the search criteria, MON (Jan/Feb/Mar/etc). But we should set this sript in cron which will run on every first day of the month. The problem I'm having is, when I run the script, it is displaying the contents of... (7 Replies)
Discussion started by: suneelj
7 Replies

6. Shell Programming and Scripting

Function to get previous month

Can someone help me creating a function which will give me previous months. like for example if the date is 200902 and if i call my function and pass a parameter 2 i want to get 200812 as the answer. or if i pass 200902 with a parameter 7 then my function should give me the date as 200807. (1 Reply)
Discussion started by: Lincy
1 Replies

7. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

8. UNIX for Dummies Questions & Answers

Get the previous month from date

Hi All, I am using the below code to get the year and month from date: Below gives output like 201212. dt=`date '+%Y%m'` how do i get the previous month value(ie: subtract 1 from date) example output: dt=201211 Please help. :confused: (3 Replies)
Discussion started by: abhi_123
3 Replies

9. Shell Programming and Scripting

Help with getting last date of previous month and first date of previous 4th month from current date

I have requirment to get last date of previous month and the first date of previous 4th month: Example: Current date: 20130320 (yyyymmdd) Last date of previous month: 20130228 (yyyymmdd) First date of previous 4th month: 20121101 (yyyymmdd) In my shell --date, -d, -v switches are not... (3 Replies)
Discussion started by: machomaddy
3 Replies
ZIP_ADD(3)						     Library Functions Manual							ZIP_ADD(3)

NAME
zip_add , - .Nm zip_replace add file to zip archive or replace file in zip archive LIBRARY
libzip (-lzip) SYNOPSIS
#include <zip.h> zip_int64_t zip_add(struct zip *archive, const char *name); "struct zip_source *source" int zip_replace(struct zip *archive, zip_uint64_t index); "struct zip_source *source" DESCRIPTION
The function zip_add adds a file to a zip archive, while zip_replace replaces an existing file in a zip archive. The argument archive specifies the zip archive to which the file should be added. name is the file's name in the zip archive (for zip_add ), while index speci- fies which file should be replaced (for zip_replace ). The data is obtained from the source argument. See the zip_source_* functions cited in SEE ALSO. RETURN VALUES
Upon successful completion, zip_add returns the index of the new file in the archive, and zip_replace returns 0. Otherwise, -1 is returned and the error code in archive is set to indicate the error. EXAMPLES
struct zip_source *s; if ((s=zip_source_buffer(archive, buffer, len)) == NULL || zip_add(archive, name, s) 0) { zip_source_free(s); printf("error adding file: %s0, zip_strerror(archive)); } ERRORS
zip_add and zip_replace fail if: [ZIP_ER_EXISTS] There is already a file called name in the archive. (Only applies to zip_add ). [ZIP_ER_INVAL] source or name are NULL, or index is invalid. [ZIP_ER_MEMORY] Required memory could not be allocated. SEE ALSO
libzip(3), zip_source_file(3), zip_source_filep(3), zip_source_function(3), zip_source_zip(3) AUTHORS
Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at> NiH March 10, 2009 ZIP_ADD(3)
All times are GMT -4. The time now is 04:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy