本帖最后由 zaqmlp 于 2022-4-9 23:51 编辑
| | | | | | | | | | | | | $outfile=".\all.csv"; | | | | $codes=@' | | using System; | | using System.Collections.Generic; | | using System.Runtime.InteropServices; | | public static class ExpDir | | { | | [DllImport("Shlwapi.dll", CharSet=CharSet.Unicode)] | | public static extern int StrCmpLogicalW(string p1, string p2); | | public static string[] Sort(string[] f) | | { | | Array.Sort(f, StrCmpLogicalW); | | return f; | | } | | } | | '@; | | Add-Type -TypeDefinition $codes; | | | | [System.Collections.ArrayList]$s=@(); | | $folders=@(dir -literal "."|?{$_ -is [System.IO.DirectoryInfo]}); | | for($i=0;$i -lt $folders.length;$i++){ | | write-host $folders[$i].Name; | | $files=@(dir -literal $folders[$i].FullName|?{$_ -is [System.IO.FileInfo]}|%{$_.Name}); | | if($files.length -ge 1){ | | $arr=[ExpDir]::Sort($files); | | $line=@($arr|%{'"'+$folders[$i].FullName+'\'+$_+'"'}) -join "`t"; | | [void]$s.add($line); | | } | | } | | [IO.File]::WriteAllLines($outfile, $s, [Text.Encoding]::Unicode);COPY |
|