function files ( )

%*****************************************************************************80
%
%% FILES illustrates some MATLAB file manipulation commands.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    25 August 2015
%
%  Author:
%
%    John Burkardt
%    
  fprintf ( 1, '\n' );
  fprintf ( 1, 'FILES:\n' );
  fprintf ( 1, '  Demonstrate MATLAB file commands:\n' );
  fprintf ( 1, '  * LS lists directory contents.\n' );
  fprintf ( 1, '  * EXIST ( name, kind ) reports if something exists.\n' );
  fprintf ( 1, '  * MKDIR ( name ) creates a directory.\n' );
  fprintf ( 1, '  * RMDIR ( name ) deletes a directory.\n' );

  name = 'mysub';
  kind = 'dir';
  status = exist ( name, kind );

  if ( status ~= 0 )

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Directory "%s" exists.\n', name );

  else

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Directory "%s" does not exist.\n', name );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Creating directory "%s"\n', name );

    mkdir ( name );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Current directory contents:\n' );
   fprintf ( 1, '\n' );

    ls;

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Removing directory "%s"\n', name );

    rmdir ( name );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Current directory contents:\n' );
    fprintf ( 1, '\n' );

    ls;

  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'FILES:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
