Skip to content

Instantly share code, notes, and snippets.

@VitaliySh
Last active October 1, 2017 16:59
Show Gist options
  • Select an option

  • Save VitaliySh/b20473a7e94653cb73c8df372049c69e to your computer and use it in GitHub Desktop.

Select an option

Save VitaliySh/b20473a7e94653cb73c8df372049c69e to your computer and use it in GitHub Desktop.
How to sort files by changing their mtime
  1. Create the list of files. For example using:

ls > list.txt

  1. sort the list.txt by hand using your text editor or do whatever you like with it

  2. Use this command to change mtime of each file in the list

while read f; do sleep 1; touch -c "$f"; done <list.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment