IPWorks Cloud 2020 Node.js Edition

Questions / Feedback?

ListDirectory Method

Lists the current directory specified by RemotePath on the server.

Syntax

cloudstorage.listDirectory([callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method is used to list the directory specified by RemotePath.

The directory entries are provided through the DirList event and also via the DirList* properties.

cloudstorage.RemoteFile = ""; //Clear filemask
cloudstorage.RemotePath = "MyFolder";
cloudstorage.ListDirectory();
for (int i = 0; i < cloudstorage.DirList.Count; i++)
{
  Console.WriteLine(cloudstorage.DirList[i].FileName);
  Console.WriteLine(cloudstorage.DirList[i].FileSize);
  Console.WriteLine(cloudstorage.DirList[i].FileTime);
  Console.WriteLine(cloudstorage.DirList[i].IsDir);
}

The RemoteFile property may also be used as a filemask when listing files. For instance:

component.RemoteFile = "*.txt"
component.ListDirectory()

Note: Since RemoteFile is used as a filemask be sure to clear or reset this value before calling ListDirectory

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Node.js Edition - Version 20.0 [Build 8265]