Last active
October 10, 2019 12:32
-
-
Save gMan1990/59c9f7387184cc56d69c4d391ecbe1a0 to your computer and use it in GitHub Desktop.
sort by created: https://github.com/ogham/exa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
import sys | |
import subprocess | |
def cmp_creation(x, y): | |
xs = x.split("/") | |
ys = y.split("/") | |
if "darwin" == sys.platform: | |
argv = ["stat", "-f", "%B"] | |
else: | |
argv = ["stat", "-c", "%W"] | |
ix = int(subprocess.check_output(argv + ["/".join(xs[0:2])])) | |
iy = int(subprocess.check_output(argv + ["/".join(ys[0:2])])) | |
return ix - iy | |
for f in sorted(sys.argv[1:], cmp=cmp_creation): | |
print(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment