This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tinypy:gui [2013/04/27 10:25] fx |
tinypy:gui [2013/05/02 16:27] (current) fx [Manipulating paths] |
||
|---|---|---|---|
| Line 31: | Line 31: | ||
| Open the file selector to open a file in write mode. If the file already exists, you'll be prompted to overwrite it. | Open the file selector to open a file in write mode. If the file already exists, you'll be prompted to overwrite it. | ||
| | | ||
| + | ==== Scanning folders ===== | ||
| + | |||
| + | __get_folder_content(folder,ext)__ | ||
| + | Return a list of file in folder 'folder" with extension 'ext'. | ||
| + | For exampl e: | ||
| + | |||
| + | lst=get_folder_content("/home/foo/videos","avi") | ||
| + | will return all .avi files in the folder /home/foo/videos. | ||
| + | Beware this is a function, not attached to gui or adm. | ||
| + | |||
| + | ==== Manipulating paths ===== | ||
| + | |||
| + | __dirname(path)__ | ||
| + | |||
| + | Return the dir that leads to path | ||
| + | dirname("/c/foo/bar.txt")=>"/c/foo" | ||
| + | |||
| + | |||
| + | __basename(path)__ | ||
| + | |||
| + | Return the filename only | ||
| + | basename("/c/foo/bar.txt")=>"bar.txt" | ||
| + | |||
| + | ==== Getting a file size ===== | ||
| + | |||
| + | __get_file_size(file)__ | ||
| + | |||
| + | Return the size of the file 'file" | ||
| + | |||
| ---- | ---- | ||
| [[using:tinypy|Go back to tinypy]] | [[using:tinypy|Go back to tinypy]] | ||