dir (ftp) - Directory contents on FTP server

Syntax

dir(f,'dirname')
d = dir(...)

Description

dir(f,'dirname') lists the files in the specified directory, dirname, on the FTP server f, where f was created using ftp. If dirname is unspecified, dir lists the files in the current directory of f.

d = dir(...) returns the results in an m-by-1 structure with the following fields for each file:

FieldnameDescriptionData Type
name

Filename

char array

date

Modification date timestamp

char array

bytes

Number of bytes allocated to the file

double

isdir

1 if name is a directory; 0 if not

logical

datenum

Modification date as serial date number

char array

Examples

Connect to the MathWorks FTP server and view the contents.

tmw=ftp('ftp.mathworks.com');
dir(tmw)

README    incoming  matlab    outgoing  pub       pubs

Change to the directory pub/pentium.

cd(tmw,'pub/pentium')

View the contents of that directory.

dir(tmw)

.                     Intel_resp.txt        NYT_2.txt             
..                    Intel_support.txt     NYT_Dec14.uu          
Andy_Grove.txt        Intel_white.ps        New_York_Times.txt    
Associated_Press.txt  MathWorks_press.txt   Nicely_1.txt          
CNN.html              Mathisen.txt          Nicely_2.txt          
Coe.txt               Moler_1.txt           Nicely_3.txt          
Cygnus.txt            Moler_2.txt           Pratt.txt             
EE_Times.txt          Moler_3.txt           README.txt            
FAQ.txt               Moler_4.txt           SPSS.txt              
IBM_study.txt         Moler_5.txt           Smith.txt             
Intel_FAX.txt         Moler_6.ps            p87test.txt           
Intel_fix.txt         Moler_7.txt           p87test.zip           
Intel_replace.txt     Myths.txt             test                

Or return the results to the structure m.

m=dir(tmw)

m = 

37x1 struct array with fields:
    name
    date
    bytes
    isdir
    datanum

View element 17.

m(17)

ans = 

     name: 'Moler_1.txt'
     date: '1995 Mar  27'
    bytes: 3427
    isdir: 0
  datenum: 728745

See Also

ftp, mkdir (ftp), rmdir (ftp)

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS