2019-03-03 04:08:54 +01:00
|
|
|
ls() Netscript Function
|
|
|
|
=======================
|
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
.. js:function:: ls(hostname[, grep])
|
2019-03-03 04:08:54 +01:00
|
|
|
|
2021-03-07 09:10:53 +01:00
|
|
|
:RAM cost: 0.2 GB
|
2021-03-12 08:51:56 +01:00
|
|
|
:param string hostname: Hostname of the target server.
|
|
|
|
:param string grep: a substring to search for in the filename.
|
|
|
|
:returns: String array of all files in alphabetical order.
|
2019-03-03 04:08:54 +01:00
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
Example:
|
|
|
|
|
|
|
|
.. code-block:: javascript
|
|
|
|
|
2023-01-06 13:43:09 +01:00
|
|
|
ns.ls("home"); // returns: ["demo.js", "msg1.txt"]
|
|
|
|
ns.ls("home", ".txt"); // returns: ["msg1.txt"]
|
|
|
|
ns.ls("home", ".script"); // returns: []
|