How to resolve the algorithm File modification time step by step in the UNIX Shell programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm File modification time step by step in the UNIX Shell programming language

Table of Contents

Problem Statement

Get and set the modification time of a file.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm File modification time step by step in the UNIX Shell programming language

Source code in the unix programming language

T=`stat -c %Y $F`


T=`stat -c %y $F`


# Note the quotation marks -- very important!
T="2000-01-01 01:02:03.040506070 -0800"
touch -c -d "$T" $F


T=200102030405.06
touch -c -t $T $F


T=02030405
touch -c -t $T $F


touch -c $F


  

You may also check:How to resolve the algorithm CSV to HTML translation step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Multiple distinct objects step by step in the Yabasic programming language
You may also check:How to resolve the algorithm Simulate input/Keyboard step by step in the Wren programming language
You may also check:How to resolve the algorithm Strip control codes and extended characters from a string step by step in the BASIC programming language
You may also check:How to resolve the algorithm Unprimeable numbers step by step in the Delphi programming language