By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,691 Members | 2,041 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,691 IT Pros & Developers. It's quick & easy.

Net::Ftp Dir command to display formatted records

P: 3
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!
Mar 24 '10 #1
Share this Question
Share on Google+
4 Replies


Expert Mod 100+
P: 589
Split the line and use printf to output it in column format.

See:
perldoc -f split
perldoc -f printf
perldoc -f sprintf
Mar 24 '10 #2

P: 3
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!
Mar 24 '10 #3

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

Thanks!
Mar 24 '10 #4

Expert Mod 100+
P: 589
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.
Mar 25 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.