Skip to content

Instantly share code, notes, and snippets.

@developerprofiles
Created May 9, 2020 15:42
Show Gist options
  • Save developerprofiles/b1ff9bac458f71be586b8f042d623ab0 to your computer and use it in GitHub Desktop.
Save developerprofiles/b1ff9bac458f71be586b8f042d623ab0 to your computer and use it in GitHub Desktop.
cls
$MainFolder = 'E:\Learning\Documents\Phones\OnePlus 1+\Telegram\Telegram Documents\Zip\Zips'
$7zipExecutable = "C:\Program Files\7-Zip\7z.exe"
$shell=new-object -com shell.application
$CurrentLocation = $MainFolder #get-location #
$CurrentPath = $CurrentLocation.path
$Location = $shell.namespace($CurrentPath)
Set-Location $CurrentLocation
Write-Host $CurrentLocation
$ZipFiles = get-childitem $MainFolder\* -Include *.zip, *.rar, *.7z* | where {$_.length -gt 22} | sort-object -property LastWriteTime -descending
$ZipFiles.count | out-default
foreach ($ZipFile in $ZipFiles)
{
Write-Host "Zipfile: $ZipFile"
$name = ([IO.Path]::Combine($_.Directory, $ZipFile.Name))
Write-Host "Zipfilename: $name"
$folder = [io.path]::GetFileNameWithoutExtension($ZipFile)
Write-Warning "Folder: $folder"
#& $7zipExecutable e -y -oC:\$folder -psomepass $name
$newfolder = "$MainFolder\$folder" #[io.path]::GetFileNameWithoutExtension($ZipFile_.Name)
Write-Warning "Newfolder: $newfolder"
If(!(test-path $newfolder))
{
New-Item -ItemType Directory -Force -Path $newfolder
}
& $7zipExecutable e -y -o$newfolder -psomepass $name
Start-Sleep -s 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment