ftouch

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - File handling
Introduced first in SolidGeometry 4.9, Creation date: 2020-03-27, Last change: 2025-09-14

file touch on mac - use carefully - does not support wildcards but only single files

Description

only full filenames are allowed for this function
the wildcard touch fails in the batch function if there are too many files such in the SG Library

See Also: , pcodeTL

Example Illustration

 missing image of ftouch(fname)

Syntax

ftouch(fname)

Input Parameter

fname: exact filename

Examples


ftouch('pcodeTL.m')




Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This algorithm is a MATLAB function named ftouch designed to update the modification timestamp of a file on macOS systems. It is part of the SolidGeometry library and was introduced in version 4.9. The function does not support wildcards and only operates on single files.

Input Parameters

Algorithm Steps

  1. The function first checks if the operating system is macOS using ismac. If not, it throws an error stating that the function is only supported on macOS.
  2. It checks if the fname contains a file separator. If not, it prints a debug message indicating that the file is in the current directory.
  3. The function then checks if the filename starts with /Volumes. If it does not, it assumes the file is in the current directory and constructs the full path using the current directory path and the filename.
  4. If the file exists, it constructs a system command to update the file's modification timestamp using the touch command with the -m option.
  5. The system command is executed using the system function, and the result is stored in fail.
  6. If the file does not exist or the system command fails, a warning is issued indicating that the file does not exist or is write-protected.
Algorithm explaination created using ChatGPT on 2025-08-18 23:51. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21