Forrest logo
back to the setfile tool

setfile:tldr:23f4d

setfile: Set modification date for symlink file (not to linked file itself).
$ setfile -P -m "${MM-DD-YYYY HH:MM:SS}" ${filename1 filename2 ---}
try on your machine

The command "setfile" is a utility available on macOS that allows you to change or set certain file attributes. Here is the breakdown of the given command:

  1. "setfile": This is the command itself that you are executing.
  2. "-P": This option ensures that file modification dates (also known as the "mtime") are preserved when using the command.
  3. "-m": This option allows you to specify a new modification date/time for the files.
    • "${MM-DD-YYYY HH:MM:SS}": This placeholder represents the desired modification date and time in the format of "month-day-year hour:minute:second". For example, "01-23-2023 15:45:00" represents January 23, 2023, at 3:45 PM.
  4. "${filename1 filename2 ---}": This represents the list of files you want to modify.
    • ${filename1 filename2 ---}: This is a placeholder for the filenames you want to modify. You can specify one or more filenames separated by spaces.

In summary, the "setfile" command with the provided options allows you to change the modification date and time of specified files on macOS while preserving other file attributes such as permissions.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the setfile tool