LC.fs.*¶
Das Modul LC.fs stellt Funktionen zur Verwaltung von Dateien und Verzeichnissen bereit.
-
LC.fs.basename(filename)¶ -
- Parameter
-
-
filename (String) – file name to extract basename from
-
- Rückgabe
-
base name (file name without path)
-
LC.fs.copy(sourcefile, destfile)¶ -
- Parameter
-
-
sourcefile (String) – Quell-Dateiname
-
destfile (String) – Ziel-Dateiname
-
- Rückgabe
-
trueoderfalse+ Fehlermeldung
Kopiert die Datei
sourcefilenachdestfile. Die Dateieigenschaften (Besitzer, Berechtigungen und Änderungs-/Zugriffsdatum) bleiben dabei erhalten.
-
LC.fs.dirname(filename)¶ -
- Parameter
-
-
filename (String) – file name to extract directory name from
-
- Rückgabe
-
directory name (without file name)
-
LC.fs.filecount(path)¶ -
- Parameter
-
-
path (String) – directory name to count files in
-
- Rückgabe
-
Anzahl der Dateien in dem Verzeichnis, oder
false+ Fehlermeldung
Return the number of files and directories in
path(excluding.and..). Non-recursive.
-
LC.fs.glob(pattern)¶ -
- Parameter
-
-
pattern (String) – zu suchendes Dateisystem-Muster
-
- Rückgabe
-
Array mit passenden Dateinamen
Build a list of file names which match
pattern(e.g./etc/liveconfig/lua.d/*.lua). If no matching files are found, an empty list is returned. The results are sorted alphabetically.
-
LC.fs.is_dir(name)¶ -
- Parameter
-
-
name (String) – zu prüfender Dateiname
-
- Rückgabe
-
trueoderfalse
Gibt
truezurück wennnameein Verzeichnis ist.
-
LC.fs.is_file(name)¶ -
- Parameter
-
-
name (String) – zu prüfender Dateiname
-
- Rückgabe
-
trueoderfalse
Gibt
truezurück wennnameeine reguläre Datei ist.
-
LC.fs.is_symlink(name)¶ -
- Parameter
-
-
name (String) – zu prüfender Dateiname
-
- Rückgabe
-
trueoderfalse
Gibt
truezurück wennnameein symbolischer Link ist.
-
LC.fs.mkdir(name)¶ -
- Parameter
-
-
name (String) – zu erstellender Verzeichnisname
-
- Rückgabe
-
trueoderfalse+ Fehlermeldung
Erstellt ein neues Verzeichnis.
-
LC.fs.mkdir_rec(name[, mode, user, group])¶ -
- Parameter
-
-
name (String) – zu erstellender Verzeichnisname
-
mode (String) – permission mode (octal value as string, e.g.
0755) -
user (String) – directory owner (user) (default:
root) -
group (String) – directory owner (group) (default:
root)
-
- Rückgabe
-
trueoderfalse+ Fehlermeldung
Create a new directory. If one or more of the parent directories don’t exist, they’re also created.
The parameters
mode,userandgroupare optional. If a directory is created recursively, all parent directories are also created withmode,userandgroup.
-
LC.fs.parse_ini(filename)¶ -
- Parameter
-
-
filename (String) – name of file to parse
-
- Rückgabe
-
table with key-value-pairs of .ini content
This function parses the given file (.ini format) and returns the contents as key-value-pairs. If an error occurs, it returns nil and an error string.
-
LC.fs.rename(oldname, newname)¶ -
- Parameter
-
-
oldname (String) – umzubenennende Datei oder Verzeichnis
-
newname (String) – neuer Name
-
- Rückgabe
-
trueoderfalse+ Fehlermeldung
Rename a file or a directory from
oldnametonewname.
-
LC.fs.setperm(name, mode, user, group)¶ -
- Parameter
-
-
name (String) – Datei- oder Verzeichnisname
-
mode (String) – new file mode (octal value, must be submitted as string!)
-
user (String) – Dateibesitzer (Benutzer)
-
group (String) – Dateibesitzer (Gruppe)
-
- Rückgabe
-
trueoderfalse+ Fehlermeldung
Change the permissions for the file or directory
name. The new permissions must be submitted as string with an octal value (e.g."0755"), anduser/groupis the new file owner name.
-
LC.fs.setUserQuota(user, path, limit)¶ -
- Parameter
-
-
user (String) – user to set quota for
-
path (String) – file system (path) to set quota
-
limit (Number) – quota limit (kB)
-
- Rückgabe
-
trueoderfalse+ Fehlermeldung
Set the diskspace quota for user
useron the device mounted atpathtolimitkilobyte.Example: set limit for user
v12007on/var/www/v12007to 200 MB (=204800 kB):LC.fs.setUserQuota("v12007", "/var/www/v12007", 204800)
-
LC.fs.setGroupQuota(group, path, limit)¶ -
- Parameter
-
-
group (String) – group to set quota for
-
path (String) – file system (path) to set quota
-
limit (Number) – quota limit (kB)
-
- Rückgabe
-
trueoderfalse+ Fehlermeldung
Set the diskspace quota for group
groupon the device mounted atpathtolimitkilobyte.
-
LC.fs.getUserQuota(user, path)¶ -
- Parameter
-
-
user (String) – user to get quota for
-
path (String) – Dateisystem (Pfad)
-
- Rückgabe
-
table or
nil+ error message (see description)
Get the diskspace quota for user
useron the device mounted atpath. The results are returned as table with the following fields:-
kb_softsoft limit in kilobytes (1024 bytes) -
kb_hardhard limit -
kb_useddisk space actually used -
n_softsoft limit of inodes (number of files & directories) -
n_hardhard limit of inodes -
n_usednumber of inodes in use
If an error occured,
niland an error message (String) is returned.
-
LC.fs.getGroupQuota(group, path)¶ -
- Parameter
-
-
group (String) – group to get quota for
-
path (String) – Dateisystem (Pfad)
-
- Rückgabe
-
table or
nil+ error message (see description)
Get the diskspace quota for group
groupon the device mounted atpath. The result table is analogous toLC.fs.getUserQuota().