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. ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| 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 |
| ||||
| 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 |