Paepoi

Paepoi » Gjs Tips » Gio etc...

Gio etc...

# 最終更新日 2017.02.05

ディレクトリ内容列挙
#!/usr/bin/gjs

const Gio = imports.gi.Gio;
 
let gFile = Gio.file_new_for_path("/home/sasakima-nao");
let fileEnumerator = gFile.enumerate_children(
    "standard::type,standard::is-hidden,standard::is-backup",
    Gio.FileQueryInfoFlags.NONE,
    null
);
for (;;) {
    let info = fileEnumerator.next_file(null);
    if (info == null) break;
    if (info.get_is_hidden()) continue;
    if (info.get_is_backup()) continue;
    if (info.get_file_type() == Gio.FileType.DIRECTORY) continue;
    print(info.get_name());
}

Copyright(C) sasakima-nao All rights reserved 2002 --- 2020.