- <# :
- cls
- @echo off
- cd /d "%~dp0"
- powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::Default))) -Args '%~f0'"
- pause
- exit
- #>
- $self=get-item -liter $args[0];
- $path=$self.Directory.FullName;
-
- $newfolder=".\#NotFound";
- $txtfile=".\Unicode.txt";
- $ext=@(".png");
-
- $newfolder=$newfolder -replace '^\.',$path;$txtfile=$txtfile -replace '^\.',$path;
- if(-not (test-path -liter $txtfile)){Write-host ('"'+$txtfile+'" not found');exit;};
- if(-not (test-path -liter $newfolder)){[void](md $newfolder)};
- $dic=New-Object 'System.Collections.Generic.Dictionary[string,string]';
- $text=[IO.File]::ReadAllLines($txtfile,[Text.Encoding]::Default);
- for($i=0;$i -lt $text.count;$i++){
- $line=$text[$i].trim();
- if(-not $dic.ContainsKey($line)){$dic.add($line,'')};
- };
- $files=@(dir -liter $path|?{($ext -contains $_.Extension) -and ($_ -is [System.IO.FileInfo])});
- for($i=0;$i -lt $files.length;$i++){
- $base=$files[$i].BaseName;
- if(-not $dic.ContainsKey($base)){
- write-host $files[$i].Name;
- move-item -liter $files[$i].FullName ($newfolder+'\'+$files[$i].Name);
- };
- }
复制代码
|