Beispiel #1
0
def recycleBin():
    summary = printHeader("RECYCLE BIN")
    if WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator):
        for drive in DriveInfo.GetDrives():
            try:
                recycleDir = DirectoryInfo(drive.Name + "$Recycle.Bin\\")
                for dir in DirectoryInfo.EnumerateDirectories(recycleDir):
                    fileList = DirectoryInfo.GetFiles(dir)
                    summary += printSubheader("Directory: {0}".format(dir.FullName))
                    for file in fileList:
                        name = file.FullName.split("\\")[-1]
                        if name.startswith("$I"):
                            info = open(file.FullName, "r").read()
                            summary += "{0}\t{1}\n".format(name.replace("$I", "$R"), info[26::2])
            except IOError:
                pass
    else:
        for drive in DriveInfo.GetDrives():
            try:
                recycleDir = drive.Name + "$Recycle.Bin\\"
                user = WindowsIdentity.GetCurrent()
                fileList = Directory.GetFiles(recycleDir + user.Owner.ToString())
                summary += printSubheader("Directory: {0}".format(recycleDir + user.Owner.ToString()))
                for file in fileList:
                    name = file.split("\\")[-1]
                    if name.startswith("$I"):
                        info = open(file, "r").read()
                        summary += "{0}\t{1}\n".format(name.replace("$I", "$R"), info[26::2])
            except IOError:
                pass

    return summary
Beispiel #2
0
def convert_files(doc_path):

    directory = DirectoryInfo(doc_path)
    files = directory.GetFiles("*.doc")

    for file_info in files:
        text = doc_to_text(Path.Combine(doc_path, file_info.Name))

        stream_writer = File.CreateText(
            Path.GetFileNameWithoutExtension(file_info.Name) + ".txt")
        stream_writer.Write(text)
        stream_writer.Close()

    return
Beispiel #3
0
def get_ik_list():
    import UserData
    import os.path
    from System.IO import DirectoryInfo
    di = DirectoryInfo(os.path.abspath(os.path.join(UserData.Path, "IKPose")))
    return [x.Name for x in di.GetFiles()]