linux - BASH : On OSX, how to list a folder randomly? -
this question has answer here:
- randomizing arg order bash statement 6 answers
i want generate list of files located in folder, randomly. tried list folder using l -s in order sort files size, it's not totally random. have best idea ?
my script :
for file in `ls $folder` ... done
- build list of files using
ls
, 1 entry per line - use
sort
--random-sort
shuffle results
Comments
Post a Comment