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

Published on 12 May 2024 09:40 PM
#E

How to resolve the algorithm File modification time step by step in the E 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 E programming language

Source code in the e programming language

def strdate(date) {
  return E.toString((date))
}

def test(type, file) {
    def t := file.lastModified()
    println(`The following $type called ${file.getPath()} ${
            if (t == 0) { "does not exist." } else { `was modified at ${strdate(t)}` }}`)
    println(`The following $type called ${file.getPath()} ${
            escape ne { file.setLastModified(timer.now(), ne); "was modified to current time." } catch _ { "does not exist." }}`)
    println(`The following $type called ${file.getPath()} ${
            escape ne { file.setLastModified(t, ne); "was modified to previous time." } catch _ { "does not exist." }}`)
}

test("file", )
test("directory", )

  

You may also check:How to resolve the algorithm File extension is in extensions list step by step in the Julia programming language
You may also check:How to resolve the algorithm Cheryl's birthday step by step in the Scala programming language
You may also check:How to resolve the algorithm Generic swap step by step in the sed programming language
You may also check:How to resolve the algorithm Dutch national flag problem step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Harshad or Niven series step by step in the FutureBasic programming language