Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (23 sloc) 1.148 kb
c12b5f7 @AndrewRadev README
authored
1 ## Overview
2
3 This little utility can be used to choose a random selection of files from a
4 given directory and output the list to stdout. The invocation looks like this:
5
6 randfiles [options] [dir1, [dir2, [...]]]
7
8 If no directories are given, the current directory is used. The possible options are:
9
e46b7bf @AndrewRadev Minor README fixes
authored
10 - `-s, --size-limit [SIZE]`: Set a size limit for the selected files. For
c12b5f7 @AndrewRadev README
authored
11 example, `randfiles --size-limit 400MB` will select up to 400MB of files.
12 - `-c --count [N]`: Set the maximum number of files. `randfiles --count 3`
13 would only choose three random files.
14
15 ## Examples
16
17 To copy a random selection of music to a flash drive, limited to 3GB, you can do
18 this:
19
20 randfiles --size-limit 3GB ~/music | xargs -i -d'\n' cp -v {} /mnt/usb
21
22 If you're unfamiliar with xargs:
e46b7bf @AndrewRadev Minor README fixes
authored
23
c12b5f7 @AndrewRadev README
authored
24 - `-i` replaces all occurrences of `{}` with what's read as input
25 - `-d'\n'` ensures that the items are delimited by newlines (there may be
26 spaces in the file names)
27
411319f @AndrewRadev Installation instructions
authored
28 ## Installation
29
30 The project is available as a gem, so this should be enough:
31
32 gem install randfiles
33
e46b7bf @AndrewRadev Minor README fixes
authored
34 ## Todo
c12b5f7 @AndrewRadev README
authored
35
36 - A `-0` option for easier piping
37 - Filtering files by regex or glob
Something went wrong with that request. Please try again.