Sample Header Ad - 728x90

How to pick a random file from a folder without repetition using bash?

4 votes
4 answers
15196 views
I can select a random file using this command find ./ -type f | shuf -n 1 But it's showing the same file some times. Is it possible to stop picking duplicate files? Is there any other utility for this task? I have around 50k txt files in a folder which may have recursive subfolders and I want to pick a random file to see it and I don't want to see it again + there are new files added to the folder every day...
Asked by Akhil (1370 rep)
Nov 22, 2019, 07:24 PM
Last activity: Nov 25, 2019, 06:18 AM