As a file is selected on Finder, the "Get Info" (Command-i) under the "File" menu brings up the "Info" window. The "Info" window displays the creation time of the file, and also provides a checkbox to lock or unlock the file.
On command line, I have been using GetFileInfo and SetFile to view/set the creation time and lockedness of files and directories. However, GetFileInfo and SetFile are now deprecated (according to their newest manpages on macOS 12 Monterey with Commandline Developer Tools).
Thus, I am looking for new commands on command line to view/set the creation time and lockedness of files and directories.
---- Update ----
I am still looking for a solution to set the creation time of file without using SetFile.
The answer by JRFerguson provided solutions to
- view the creation time of file
- view whether a file is locked or unlocked
- lock or unlock a file
but did not provide a solution to set the creation time.
The manpages of SetFile and GetFileInfo on macOS 12 Monterey with Commandline Developer Tools say:
Tools supporting Carbon development,
including /usr/bin/SetFile,
were deprecated with Xcode 6.
Tools supporting Carbon development,
including /usr/bin/GetFileInfo,
were deprecated with Xcode 6.
Xcode 6 was around some time ago. The most recent is Xcode 13, which is for macOS 12 Monterey. Carbon and Cocoa were APIs to develop macOS applications. Carbon was a bridge between Classic Mac (MacOS 9) and MacOS X. Carbon was removed from macOS X 10.15 Catalina. As of macOS 12 Monterey, Cocoa is the sole primary API to develop macOS applications.
Even though SetFile and GetFileInfo are still available on macOS 12 Monterey with Commandline Developer Tools, they are expected to become unavailable in the future.
The above citations from the manpages sound that the commandline commands SetFile and GetFileInfo accompanied Carbon. As Carbon was removed from macOS X 10.15 Catalina, and as Cocoa is now the sole primary API for developing macOS applications, I thought that there should be new commandline commands that accompany Cocoa, replacing SetFile and GetFileInfo. This is why I said "successors" of SetFile and GetFileInfo. Is there any commandline tool accompanying Cocoa, working like SetFile to set the creation time of files and directories?