home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / rbemx144.zip / ruby-1.4.4 / sample / fullpath.rb < prev    next >
Text File  |  1998-01-16  |  335b  |  24 lines

  1. #! /usr/local/bin/ruby
  2. # convert ls-lR filename into fullpath.
  3.  
  4. if ARGV[0] =~ /-p/
  5.   ARGV.shift
  6.   path = ARGV.shift 
  7. end
  8.  
  9. if path == nil
  10.   path = ""
  11. elsif path !~ /\/$/
  12.   path += "/"
  13. end
  14.  
  15. while gets()
  16.   if /:$/
  17.     path = $_.chop.chop + "/"
  18.   elsif /^total/ || /^d/
  19.   elsif /^(.*\d )(.+)$/
  20.     print($1, path, $2, "\n")
  21.   end
  22. end
  23.     
  24.