HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

setfile — Set file attributes on files in an HFS+ directory. More information: <https://ss64.com/mac/setfile.h

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandfileshfsattributesclifilesetsetfile
macos

Problem

How to use the setfile command: Set file attributes on files in an HFS+ directory. More information: <https://ss64.com/mac/setfile.html>.

Solution

setfile — Set file attributes on files in an HFS+ directory. More information: <https://ss64.com/mac/setfile.html>.

Set creation date for specific files:
setfile -d "{{MM/DD/YYYY HH:MM:SS}}" {{path/to/file1 path/to/file2 ...}}


Set modification date for specific files:
setfile -m "{{MM/DD/YYYY HH:MM:SS}}" {{path/to/file1 path/to/file2 ...}}


Set modification date for symlink file (not to linked file itself):
setfile -P -m "{{MM/DD/YYYY HH:MM:SS}}" {{path/to/file1 path/to/file2 ...}}

Code Snippets

Set creation date for specific files

setfile -d "{{MM/DD/YYYY HH:MM:SS}}" {{path/to/file1 path/to/file2 ...}}

Set modification date for specific files

setfile -m "{{MM/DD/YYYY HH:MM:SS}}" {{path/to/file1 path/to/file2 ...}}

Set modification date for symlink file (not to linked file itself)

setfile -P -m "{{MM/DD/YYYY HH:MM:SS}}" {{path/to/file1 path/to/file2 ...}}

Context

tldr-pages: osx/setfile

Revisions (0)

No revisions yet.