Sponsored Content
Top Forums Shell Programming and Scripting Shell script for Creating Directory with name as system date Post 91944 by aarora_98 on Tuesday 6th of December 2005 05:19:46 PM
Old 12-06-2005
Shell script for Creating Directory with name as system date

Dear Sir/Madam,

I need a bit of your help. The problem is as follows :

I have to create a directory in unix whose name is that of system date in the dd_mon_yyyy format . I am able to extract a date in required format ina variable , but when i'm using this variable in mkdir it is not creating a directory of that date, rather it is creating the dirictory of the same name as the variable( mkdir accepts a string name for creating directories , but I don't know how to convert date to string using shell scripting). I am writing below the piece of script of what I am doing. Plz correct me where ever possible. i hope to see a nice running solution from your side.

>Today='date +%d_%m_%Y'
>set
>$Today
>mkdir $Today

I hope you will help me.

plz do mail me a solution at EMAIL ADDRESS REMOVED

Thanks in advance.
Arun

Last edited by Perderabo; 12-06-2005 at 09:14 PM.. Reason: Remove email address
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script to selectively tar directory based on date

hye everybody :) , i'm new to the scripting world.. hope you guys can help me out with this one.. i'm trying to identify any directory under /tmp/saya that is created more than one day from the current date.. e.g, today is March 14, so any directory that has time stamp March 13 backwards, i... (2 Replies)
Discussion started by: fara_aris
2 Replies

2. Shell Programming and Scripting

Creating date directory and moving files into that directory

I have list of files named file_username_051208_025233.log. Here 051208 is the date and 025233 is the time.I have to run thousands of files daily.I want to put all the files depending on the date of running into a date directory.Suppose if we run files today they should put into 05:Dec:08... (3 Replies)
Discussion started by: ravi030
3 Replies

3. Shell Programming and Scripting

How to increment a user defined date value in the DATE format itself using shell script?

I need to increment a date value through shell script. Input value consist of start date and end date in DATE format of unix. For eg. I need increment a date value of 1/1/09 to 31/12/09 i.e for a whole yr. The output must look like 1/1/09 2/2/09 . . . 31/1/09 . . 1/2/09 . 28/2/09... (1 Reply)
Discussion started by: sunil087
1 Replies

4. Shell Programming and Scripting

Creating a directory if its non-existent within a script

Hi, is there a way to create a directory when its non-existent when trying to move files to this particular folder? Thanks much. (7 Replies)
Discussion started by: ida1215
7 Replies

5. Programming

Script for creating a directory & move the .tif files in it.

Hi Team, I have thousands of TIF files which are converted from PDF. Below is a sample of it. LH9406_BLANCARAMOS_2012041812103210320001.tif LH9406_BLANCARAMOS_2012041812103210320002.tif LH9406_BLANCARAMOS_2012041812103210320003.tif LH9411_ANGENIAHUTCHINSON_2012041812102510250001.tif... (9 Replies)
Discussion started by: paragnehete
9 Replies

6. Homework & Coursework Questions

Creating a .profile, displaying system variables, and creating an alias

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Here is what I am supposed to do, word for word from my assignment page: 1. Create/modify and print a... (2 Replies)
Discussion started by: Jagst3r21
2 Replies

7. UNIX for Dummies Questions & Answers

Creating a directory based on date

I want to create a directory based on date. I do not have date -d command. What I do have is: either use "date" command to get current date or DATE1=$(perl -e 'print scalar(localtime(time - 1 )), "\n";' |awk '{print $2,$3,$5}') |awk '{print $3}'can be modified to produce the desired year.... (3 Replies)
Discussion started by: newbie2010
3 Replies

8. UNIX for Beginners Questions & Answers

Compare date in .txt with system date and remove if it's lesser than system date

Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt . I don't want to delete... (2 Replies)
Discussion started by: Stuti
2 Replies

9. Answers to Frequently Asked Questions

Compare date in .txt with system date and remove if it's lesser than system date

I m working on shell scripting and I m stuck where in my .txt file there is column as expiry date and I need to compare that date with system date and need to remove all the rows where expiry date is less than system date and create a new .txt with update. (1 Reply)
Discussion started by: Stuti
1 Replies

10. Linux

How to calculate the quarter end date according to the current date in shell script?

Hi, My question is how to calculate the quarter end date according to the current date in shell script? (2 Replies)
Discussion started by: Divya_1234
2 Replies
DDATE(1)						     Emperor Norton Utilities							  DDATE(1)

NAME
ddate - converts Gregorian dates to Discordian dates SYNOPSIS
ddate [+format] [date] DESCRIPTION
ddate prints the date in Discordian date format. If called with no arguments, ddate will get the current system date, convert this to the Discordian date format and print this on the stan- dard output. Alternatively, a Gregorian date may be specified on the command line, in the form of a numerical day, month and year. If a format string is specified, the Discordian date will be printed in a format specified by the string. This mechanism works similarly to the format string mechanism of date(1), only almost completely differently. The fields are: %A Full name of the day of the week (i.e., Sweetmorn) %a Abbreviated name of the day of the week (i.e., SM) %B Full name of the season (i.e., Chaos) %b Abbreviated name of the season (i.e., Chs) %d Ordinal number of day in season (i.e., 23) %e Cardinal number of day in season (i.e., 23rd) %H Name of current Holyday, if any %N Magic code to prevent rest of format from being printed unless today is a Holyday. %n Newline %t Tab %X Number of days remaining until X-Day. (Not valid if the SubGenius options are not compiled in.) %{ %} Used to enclose the part of the string which is to be replaced with the words "St. Tib's Day" if the current day is St. Tib's Day. %. Try it and see. EXAMPLES
% ddate Sweetmorn, Bureaucracy 42, 3161 YOLD % ddate +'Today is %{%A, the %e of %B%}, %Y. %N%nCelebrate %H' Today is Sweetmorn, the 42nd of Bureaucracy, 3161. % ddate +"It's %{%A, the %e of %B%}, %Y. %N%nCelebrate %H" 26 9 1995 It's Prickle-Prickle, the 50th of Bureaucracy, 3161. Celebrate Bureflux % ddate +'Today's %{%A, the %e of %B%}, %Y. %N%nCelebrate %H' 29 2 1996 Today's St. Tib's Day, 3162. BUGS
ddate(1) will produce undefined behaviour if asked to produce the date for St. Tib's day and its format string does not contain the St. Tib's Day delimiters %{ and %}. NOTE
After `X-Day' passed without incident, the Church of the SubGenius declared that it had got the year upside down - X-Day is actually in 8661 AD rather than 1998 AD. Thus, the True X-Day is Cfn 40, 9827. AUTHOR
Original program by Druel the Chaotic aka Jeremy Johnson (mpython@gnu.ai.mit.edu) Major rewrite by Lee H:. O:. Smith, KYTP, aka Andrew Bulhak (acb@dev.null.org) Five tons of flax. DISTRIBUTION POLICY
Public domain. All rites reversed. SEE ALSO
date(1), http://www.subgenius.com/ Malaclypse the Younger, Principia Discordia, Or How I Found Goddess And What I Did To Her When I Found Her 59 Bureaucracy 3161 DDATE(1)
All times are GMT -4. The time now is 09:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy