Net::Ftp Dir command to display formatted records

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeffreypry
    New Member
    • Mar 2010
    • 3

    Net::Ftp Dir command to display formatted records

    Using Net::Ftp, how can i get the dir command to display records in a formatted way? It now just spits out each line from the server as an array entry (the entire line, no columns). How can I make it so when I output I can put the data into columns?

    Thanks!
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    Split the line and use printf to output it in column format.

    See:
    perldoc -f split
    perldoc -f printf
    perldoc -f sprintf

    Comment

    • jeffreypry
      New Member
      • Mar 2010
      • 3

      #3
      Example

      Can you please provide an example? I am extremely new at Perl.

      Heres is what I'm working with:

      MyArray
      -----------
      0 | xddx--xx-ddx 02 DEC 09 File1.xls 233 username
      1 | xddx--xx-ddx 02 DEC 10 File2.xls 233 username
      2 | xxdx--xx-ddx 02 DEC 11 File6.xls 233 username
      3 | xxdx--xx-ddx 02 DEC 12 File3.uhf 233 username
      4 | xxxx--xx-ddx 02 DEC 12 File5.csv 233 username

      How would I use the examples you provided above on the sample data? Thank you so much for your help!

      Comment

      • jeffreypry
        New Member
        • Mar 2010
        • 3

        #4
        They are all on their own lines, but not seperated by commas, also the spaces in between them aren't constant, they fluctuate...

        Thanks!

        Comment

        • RonB
          Recognized Expert Contributor
          • Jun 2009
          • 589

          #5
          The documentation I pointed to has examples. Please give it a try and if you have trouble, post your script and ask specific questions on the parts that are giving you trouble.

          Comment

          Working...