如果父文件夹与当前文件夹的权限不同,请保存ACL

时间:2016-10-10 09:57:30

标签: powershell permissions user-permissions get-childitem

我的目标是读取驱动器文件夹的用户权限并将其保存到文件中。

脚本应检查父文件夹的权限,并将其与当前文件夹进行比较。如果权限等于当前文件夹,则不应保存。

我的尝试如下:

ls -r | Where-Object { $_.mode -notmatch "a" } | %{ 
    $path = Get-Location 
    if(((Get-Location | Get-Acl).AccessToString) -ne (((Get-Item $path).parent.FullName) | Get-Acl).AccessToString){
        Get-Location | Get-Acl | Export-Csv -Delimiter ";" c:\ACL1.csv
     }
}

不幸的是,我不知道lsGet-Childitem)命令的执行过程以及我如何处理ls"执行列表" ...使用$ path尝试失败并显示缺陷注释

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

ACL

这将通过目录检查当前文件夹对其父文件夹的权限(一级)来回避。如果权限不匹配,则当前文件夹的CSV会附加到c:\ACL1.csv文件public static void main(String[] args) throws Exception { // Create the Stanford CoreNLP pipeline Properties props = new Properties(); props.setProperty("annotators", "tokenize,ssplit,pos,lemma,depparse,natlog,openie"); props.setProperty("openie.triple.strict", "false"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); // Annotate an example document. //File inputFile = new File("src/test/resources/0.txt"); //String text = Files.toString(inputFile, Charset.forName("UTF-8")); String text = "Cats do not drink milk."; Annotation doc = new Annotation(text); pipeline.annotate(doc); // Loop over sentences in the document for (CoreMap sentence : doc.get(CoreAnnotations.SentencesAnnotation.class)) { // Get the OpenIE triples for the sentence Collection<RelationTriple> triples = sentence.get(NaturalLogicAnnotations.RelationTriplesAnnotation.class); // Print the triples for (RelationTriple triple : triples) { System.out.println(triple.confidence + "|\t" + triple.subjectLemmaGloss() + "|\t" + triple.relationLemmaGloss() + "|\t" + triple.objectLemmaGloss()); } }