awk version of list-dates works faster
[backups/.git] / scripts / files-from-date.rb
1 #!/usr/bin/ruby
2
3 # Make sure the record separator is zero rather than new-line
4 $/ = "\0"
5
6 # The only argument is the date for which to list files
7 date = ARGV.shift.to_i
8
9 ARGF.each do |line|
10   # The seventh and eigth fields are the backup date and the file name.
11   backupdate,name = line.split( ' ', 8 )[6,7]
12
13   # Print the name if the backup date matches
14   print name if date == backupdate.to_i
15 end