Unix Technical Forum

mkdir with dynamique names

This is a discussion on mkdir with dynamique names within the Debian Linux support forums, part of the Debian Linux category; --> Hi all, How could you dynamicaly create a folder named: backup-dd--mm--yy with dd: current day, mm:current month; yy:current year. ...


Go Back   Unix Technical Forum > Unix Operating Systems > Debian Linux > Debian Linux support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 07:18 AM
John Smith
 
Posts: n/a
Default mkdir with dynamique names

Hi all,

How could you dynamicaly create a folder named:

backup-dd--mm--yy

with dd: current day, mm:current month; yy:current year.





thanks for answer,

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 07:18 AM
gregor herrmann
 
Posts: n/a
Default Re: mkdir with dynamique names

On Sat, 22 Oct 2005 10:38:55 +0200, John Smith wrote:

> How could you dynamicaly create a folder named:
> backup-dd--mm--yy


$ date +"%d--%m--%y"
gives you current date in your desired format, and the complete
command would be:
$ mkdir backup-`date +"%d--%m--%y"`
or
$ mkdir backup-$(date +"%d--%m--%y")
(depending on the shell)

BTW: I'd suggest to use the ISO date format. i.e. "date --iso-8601" ->
$ mkdir backup-`date --iso-8601`

gregor
--
.''`. http://info.comodo.priv.at/ | gpg key ID: 0x00F3CFE4
: :' : infos zur usenet-hierarchie at.*: http://www.usenet.at/
`. `' member of https://www.vibe.at/ | how to reply: http://got.to/quote/
`- NP: Sinéad O'Connor - Never Get Old
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 07:18 AM
John Smith
 
Posts: n/a
Default Re: mkdir with dynamique names, many thanks

Many thanks, Gregor, for your answer.
It works fine with

mkdir backup-`date --iso-8601`



best regards,
cu.








gregor herrmann wrote:
> On Sat, 22 Oct 2005 10:38:55 +0200, John Smith wrote:
>
>
>>How could you dynamicaly create a folder named:
>>backup-dd--mm--yy

>
>
> $ date +"%d--%m--%y"
> gives you current date in your desired format, and the complete
> command would be:
> $ mkdir backup-`date +"%d--%m--%y"`
> or
> $ mkdir backup-$(date +"%d--%m--%y")
> (depending on the shell)
>
> BTW: I'd suggest to use the ISO date format. i.e. "date --iso-8601" ->
> $ mkdir backup-`date --iso-8601`
>
> gregor

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:04 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com