randfile: Program for picking a random file

[ bsd3, program, system ] [ Propose Tags ]

This program selects a random file from the current directory, including files in subdirectories. If you like to manage your music collection using the command line, this program can be used to approximate "shuffle".

More precisely, it starts at the current directory, picks a random entry, and descends if it is a directory. It does not give more weight to directories containing more files. It should only fail if there are no regular files under the current directory that you can see.

If you are wondering why I bothered to use crypto-grade random number generation, it is because I found System.Random to be unsatisfactory. With System.Random, this program tended to return the same file repeatedly.

Note: on Unix, this program follows symbolic links, while on Windows, it doesn't. Symbolic links were introduced in Windows Vista and Windows Server 2008.


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS]
Dependencies base (>=4 && <5), crypto-api, directory, filepath, monadcryptorandom, transformers, unix, Win32 [details]
License BSD-3-Clause
Copyright Copyright (c) Joseph Adams 2011
Author Joey Adams
Maintainer joeyadams3.14159@gmail.com
Category System
Uploaded by JoeyAdams at 2011-10-19T21:17:57Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables randfile
Downloads 1118 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2015-09-30 [all 8 reports]