in reply to Parsing FTP ls command results
And if this code is run:#!/usr/bin/perl use warnings; use strict; while(<DATA>) { chomp; my @elements = split /\s+/, $_; if ( $elements[2] eq '<DIR>' ) { print "Directory: ",$elements[3], "\n"; } else { print "The size of $elements[3] is $elements[2] bytes.\n"; } } __DATA__ 03-26-07 05:23AM <DIR> html 03-26-07 04:27AM <DIR> ibm-laptop 03-26-07 03:16AM <DIR> images 03-27-07 11:00PM 6397 index.html 03-26-07 03:45AM 10186 index1.html
~/perl/monks$ ./parselist.pl Directory: html Directory: ibm-laptop Directory: images The size of index.html is 6397 bytes. The size of index1.html is 10186 bytes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing FTP ls command results
by johngg (Canon) on Sep 13, 2007 at 12:44 UTC | |
by Anonymous Monk on May 04, 2009 at 00:58 UTC | |
|
Re^2: Parsing FTP ls command results
by roboticus (Chancellor) on Dec 09, 2010 at 13:32 UTC |