1. Home
  2. Docs
  3. Manual
  4. Playbook
  5. Command list
  6. FileListCommand component

FileListCommand component

Obtain a list of files for the remote session.
interface with the same name but lowercase initial is encapsulated. The specific source code is as follows: https://github.com/aoyiduo/woterm/blob/main/woterm/js/async.js
Its reference example:
https://github.com/aoyiduo/woterm/blob/main/private/playbooks/test/TestFileContentCommand.qml

The core code is as follows:

import FileListCommand 1.0

FileListCommand {
   id: fileList
}

asyncGenerator(function *(){
    Playbook.log("command start.")
    fileList.hosts = hosts.text.split(',')
    yield fileListCommand(fileList, pathRemote.text, function(host, code){
       for(let id in fileList.fileInfos) {
          let fi = fileList.fileInfos[id]
          let msgs = []
          for(let key in fi) {
             msgs.push(key+":"+fi[key])
          }
          Playbook.log(msgs.join(','))
       }
    })

    Playbook.log("command finish.")
})();

The Property list is as follows:
QString path: Specify the path to the file list.
QVariantList fileInfos:Information about the file list, including file name, permissions, directory or file attributes, file size, and other attributes.
QStringList fileNames: the list of file names.