I have two directories: c:\Rar and c:\unRared
Rar - contains hundreds of RA开发者_C百科R'ed files. Only one file inside the RAR. File inside the archive is with *.TRN extension. UnRared has unarchived files (hundreds of files with *.TRN extension)
I've been trying to create a Powershell script to extract only files that have not been extracted already.
can't you just supply parameters to whatever compression program you have telling it not to overwrite existing files?
Knocked this out on my own...well, not really, with the help of developer
$dir1='C:\temp\aaa'
$dir2='C:\temp\bbb'
$CmdPath = "C:\Program Files (x86)\WinRAR\RAR.exe"
$Files2Extract = get-childitem -path 'C:\temp\aaa' -recurse -name -filter *.rar
#$d2 = get-childitem -path $dir2 -recurse
foreach($file in $Files2Extract){
$justname = $dir2+'\\'+(split-path $file -leaf).split(".")[0]+'.trn'
if(!(Test-Path -path $justname)) {
&$CmdPath e $file $dir2
}
}
精彩评论