Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

UNIX Bash – Create Date/Time File Name

Posted on August 25, 2016October 4, 2019 By David Kittell

When you need to create a log file or some dated archive

echo "This is a dated file $(date +%Y_%m_%d_%H.%M.%S)" > testfile_`date +%Y_%m_%d_%H.%M.%S`.txt

The format can be modified slightly based on date formatting.

Originally Posted on August 25, 2016
Last Updated on October 4, 2019
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

CentOS Code Fedora Mac OSX Red Hat Ubuntu UNIX UNIX Shell Scripts datedate/timefile namefilenametime

Post navigation

Previous post
Next post

Related Posts

SQL – Log Parser Studio – IIS Logs

Posted on December 4, 2015

/* Compare file sizes of the last 10 days of IIS logs */ /* Log Type: FSLog */ SELECT Path, Size, LastWriteTime FROM ‘[LOGFILEPATH]’ ORDER BY LastWriteTime ASC /* User-Agent Report */ /* Log Type: IISW3CLOG */ SELECT DISTINCT cs(User-Agent), count(*) AS hits FROM ‘[LOGFILEPATH]’ GROUP BY cs(User-Agent) ORDER BY…

Read More

Monday Date Calculation

Posted on July 31, 2013October 26, 2015

— SQL user-defined function — SQL scalar function – UDF CREATE FUNCTION fnMondayDate ( @Year INT, @Month INT, @MondayOrdinal INT ) RETURNS DATETIME AS BEGIN DECLARE @FirstDayOfMonth CHAR(10), @SeedDate CHAR(10) SET @FirstDayOfMonth = convert(VARCHAR, @Year) + ‘-‘ + convert(VARCHAR, @Month) + ‘-01’ SET @SeedDate = ‘1900-01-01’ RETURN DATEADD(DD, DATEDIFF(DD, @SeedDate,…

Read More

ICD-9 Generator

Posted on August 21, 2014October 26, 2015

<%@ Page Language="C#"%> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Collections.Generic" %> <%@ Import Namespace="System.Collections.Specialized" %> <%@ Import Namespace="System.Configuration" %> <%@ Import Namespace="System.Data.Common" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.Drawing" %> <%@ Import Namespace="System.Drawing.Printing" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Net.Mail" %> <%@ Import Namespace="System.Text" %> <%@ Import Namespace="System.Text.RegularExpressions"…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes