Open up the Terminal application ( /Applications/Utilities/Terminal.app) or if you prefer use iTerm. How to change the date created attribute of a file? If created before the date you set, only the modified date will be changed. This is because a file cannot be modified before it has been created. Note that this will change both the date modified and date created attributes only if your file was created after the date you enter. The following is from this page which is also useful reference, and a great example with some tips for those who are uncomfortable with file locations on the command line Some set the time to be the time of another file, some set it to go back, or forward in time by X amount, ( see here for more details), eg: touch -d ' 10:22' file8 This is what parameters like -t and others do. More advanced usage of the touch command allows you to specify the time you want to set, rather than using the time at execution, set access instead of modification times etc. Or, you can simply add the full path to the file as part of the command: touch ~/Desktop/files/PDFs/filename the cd or Change Directory command helps here: cd ~/Desktop/files/PDFs Of course, you may need to find the file first, which could require further commands to get to it. Typing the following will set the last modified date of the file to the current time: touch filename So, the command is called touch, and after the command you can pass various parameters, the only required one being the filename. Just because you are typing doesn't mean it has anything to do with coding, but to someone new to "old fashioned" OS commands it can look a little intimidating. Once you start it, you get a command line window where you can type in commands. You can find this in your Utilities folder, or use Spotlight search to find it. The place you type it in is an app called Terminal. ![]() The command-line touch command works in Lion, but you need a little background on how to use it.įirstly, you need to type it in, it's not a utility that operates graphically in a window. (Of course, resetting the system date may not be a risk-free operation, you've been warned.) ![]() In summary, to be able to change the four timestamps independently, one may use (in this order for the last 3): Unfortunately, it is not possible to specify the time explicitly here other than by changing the computer's time. This doesn't change the ownership of the file, but accesses the file's inode and records this as a time of last status change. Where username is the owner of the file (as reported by stat or ls -l). The first date listed is last access time ( atime), the second is last modification time ( mtime), the third is last status change ( ctime), the fourth is time of file creation (birth, Btime), see man lstat. These timestamps are not always updated independently from each other, but one can have some individual control with a bit of care and with use of touch, SetFile, and chown (or chmod). In Mac OS X there appears to be four different timestamps associated with a file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |