12345678910111213141516171819202122232425262728 |
- # -*- coding: utf-8 -*-
- from __future__ import unicode_literals
- from subprocess import check_output, STDOUT
- import subprocess
- '''
- '''
- def list_files_and_folders(path, hiddens=True):
- output = check_output(['ls', '-a', path], stderr=STDOUT)
- items = []
- for item in output.split('\n'):
- if item == '' or item == '.' or item == '..':
- continue
-
- if not hiddens and item.startswith('.'):
- continue
- items.append(item)
- return {
- 'items': items
- }
- '''
- '''
- def execute(command=[]):
- return check_output(command)
|