dir

List contents of folder on target computer

Description

example

dir(filesys_object) lists the contents of the currently active folder on the target computer.

Note: The SimulinkRealTime.fileSystem object will be removed in a future release. See the release note for file system commands to use instead. These commands use the SimulinkRealTime.openFTP function and the functions for the MATLAB ftp object.

example

dir(filesys_object, folder_name) lists the contents of folder folder_name on the target computer.

example

dir_info = dir(filesys_object, ___) returns the results in a structure array.

Examples

collapse all

List the contents of the currently active folder

tg = slrt;
fsys = SimulinkRealTime.fileSystem(tg);
dir(fsys)
 20/6/2011	15:09  <DIR>           0	    FDOS     
16/11/2011	14:10  <DIR>           0	$RECYCLE  BIN
30/10/2015	17:38  <DIR>           0	 NWR_TMP     
 18/8/2006	 3:58              45341	  KERNEL  SYS
 28/8/2006	18:40              66945	 COMMAND  COM
 28/3/2013	11:49               1604	AUTOEXEC  BAT
 7/11/2011	16:55                207	FDCONFIG  SYS
  7/8/2007	12:09              14509	  CONFIG  TEL
 25/6/2008	20:18               3066	 DEVLOAD  COM
  1/5/2010	14:05              33902	  DOSUSB  COM
 26/1/2009	 3:07              62279	E100BODI  COM
 21/9/2010	13:00              48123	E1000ODI  COM
  7/8/2007	 4:42             165262	  FTPBIN  EXE
  3/5/1999	15:50              39748	  IPXODI  COM
  8/2/2010	20:35              31919	LISTDEVS  EXE
 30/1/2010	 8:34               1394	 LPT1USB  SYS
  3/5/1999	15:50              18356	     LSL  COM
 27/2/2008	 8:16                513	     NET  CFG
 13/6/2002	14:45               3310	ODIPKT30  COM
  7/8/2007	10:16                 13	PASSWORD  TEL
 9/12/2005	21:06              16536	 RTTBOOT  COM
 27/2/2008	 8:18                236	  RUNFTP  BAT
 28/8/2008	21:42               1559	  SERDRV  SYS
 14/6/2002	18:55              17032	 TELPASS  EXE
 13/6/2002	16:20               1514	  TERMIN  COM
  6/3/2010	13:00               7165	 USBDISK  SYS
 23/1/2010	17:17              36752	 USBVIEW  EXE
 27/3/2014	11:49                  0	     DOS   SG
  1/8/2012	15:14              16370	 XPCBOOT  COM
 27/3/2014	11:49            1140726	  XPMTGO  RTB
  6/5/2014	16:28                  0	 FREEDOS     
  6/5/2014	16:45            1276571	 XPCKRNL  RTB
 13/8/2015	17:04             310451	XPCTRACE  CSV
 17/4/2015	10:53              36503	BOUNCIN1  DLM
30/10/2015	17:04                  0	NEW_DATA  DAT

List the contents of folder 'FDOS'

tg = slrt;
fsys = SimulinkRealTime.fileSystem(tg);
dir(fsys, 'FDOS')
 20/6/2011	15:09  <DIR>           0	PACKAGES     
 20/6/2011	15:09  <DIR>           0	 APPINFO     
 20/6/2011	15:09  <DIR>           0	     BIN     
 20/6/2011	15:09  <DIR>           0	     DOC     
 20/6/2011	15:09  <DIR>           0	    HELP     
 20/6/2011	15:09  <DIR>           0	     NLS     
 20/6/2011	15:09  <DIR>           0	     CPI     
 20/6/2011	15:09  <DIR>           0	    TEMP     
 20/6/2011	15:09              14025	 INSTALL  LOG
 15/8/2002	23:59              18353	 COPYING     
 19/5/2006	18:27              26444	 COPYING  LIB
  4/9/2006	 1:14               8692	POSTINST  BAT
  1/9/2006	20:23               3389	 POSTSET  BAT
 24/1/2004	 3:44              11197	  CONFIG  SYS

Return the contents of folder 'FDOS' as a structure array.

tg = slrt;
fsys = SimulinkRealTime.fileSystem(tg);
dir_info = dir(fsys, 'FDOS')
dir_info = 

1x14 struct array with fields:

    date
    time
    isdir
    bytes
    name

List one of the items in the array.

dir_info(1)
ns = 

     date: '20/6/2011'
     time: '15:09'
    isdir: 1
    bytes: 0
     name: {'PACKAGES'  ''}

Input Arguments

collapse all

File system object created by using the SimulinkRealTime.fileSystem creation function.

The file system object represents the target computer file system. You work with the target computer file system from the development computer by using file system methods.

Example: fsys

Data Types: struct

If you omit the drive letter, the command assumes that the folder path is relative to the default drive.

A fully qualified folder name can have a maximum of 248 characters, including the drive letter, colon, and backslash.

Example: logs

Data Types: char

Output Arguments

collapse all

The array consists of the following fields:

  • date — The last date at which the file or folder was saved.

  • time — The last time at which the file or folder was saved.

  • isdir — If 1, the item is a folder. If 0, it is not a folder.

  • bytes — Size of the filer or folder, in bytes.

  • name — Name of an object in the folder, shown as a cell array. The name, stored in the first element of the cell array, can have up to eight characters. The three-character file extension is stored in the second element of the cell array.

Introduced in R2014a