fts_set - Linux


fts_set provides a user-friendly interface to manage filesystem timestamps. It allows you to set, adjust, or reset timestamps on files and directories, including the modification, access, and creation times.


fts_set [options] <path>


  • -m, –modification: Set or adjust the modification timestamp.
  • -a, –access: Set or adjust the access timestamp.
  • -c, –creation: Set or adjust the creation timestamp.
  • -t, –time: Specify a timestamp in the format "YYYY-MM-DD hh:mm:ss".
  • -s, –shift: Shift the timestamp by a specified number of seconds.
  • -u, –user: Set the timestamp to the current user’s login time.
  • -g, –group: Set the timestamp to the current group’s login time.
  • -v, –verbose: Print detailed information during execution.
  • -h, –help: Display usage information.


Set the modification time of a file to 2023-07-14 15:30:00:

fts_set -m "2023-07-14 15:30:00" file.txt

Shift the access time of a file back by 3 days:

fts_set -a -s -259200 file.txt

Set the creation time of a directory to the current user’s login time:

fts_set -c -u directory

Common Issues

  • Timestamps not being set: Ensure you have write permissions to the file or directory.
  • Invalid timestamp format: Verify the timestamp follows the specified format "YYYY-MM-DD hh:mm:ss".
  • Timestamp not changing: Try using sudo to elevate privileges or check for file system permissions that prevent modification.


Combine with "find":

find . -name "*.txt" -exec fts_set -m "2023-07-14 15:30:00" {} \;

Related Commands

  • touch: Modify file timestamps.
  • exiftool: Extract and edit metadata, including timestamps.
  • stat: Display file and directory status, including timestamps.