Search notes:

Script: touch.ps1

touch.ps1 is a very basic PowerShell script which mimicks the (IMHO) two most important use cases of the Unix touch command:
The script accepts multiple files as string array ([string[]]), that is, their names must be separated by commas:
PS C:\Users\Rene> touch foo.txt, bar,txt, baz.txt

Source code

param (
   [string[]] $fileList
)

set-strictMode -version 3

foreach ($fileName in $fileList) {
   if (test-path $fileName) {
      $file = get-item $fileName
      $file.lastAccessTime = get-date
      $file.lastWriteTime  = $file.lastAccessTime
   }
   else {
      $null = new-item $fileName
   }
}
Github repository scripts-and-utilities, path: /touch.ps1

See also

Other Scripts

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758207399, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/tools/scripts/personal/touch_ps1(64): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78