Last active
September 21, 2019 22:16
-
-
Save halk/2c7368d7aed58026ae6c to your computer and use it in GitHub Desktop.
Change order by creation date
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
#!/bin/bash | |
COUNTER=$(($(ls -l | wc -l)-1)) | |
IFS=$'\n' # make new lines the only separator | |
for f in `ls | sort -n` | |
do | |
# for linux: touch -t `date -v-${COUNTER}S '+%Y%m%d%H%M.%S'` $f | |
SetFile -d `date -v-${COUNTER}S '+%m/%d/%Y %H:%M:%S'` $f # Mac OS X | |
COUNTER=$((COUNTER-1)) | |
done |
touch in linux only changes files modified date/time but wont change the creation date/time as linux do not have the creation date or time concept.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had to use this to get order into mp3 files for the EasyAcc external speaker which sorts by creation date