Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function convert-file($source, $destination)
- {
- try{
- $i = [System.Drawing.Image]::FromFile($File.FullName)
- $i.Save("$t","$IMGType")
- } catch{ Write-Host "Errored on converting $file.fullname"
- } finally {
- }
- }
- function cleanfile($oldfile, $newfile){
- if( Test-Path -Path $newfile){
- Remove-Item $oldfile
- }
- }
- ForEach ($File in $Files) {
- try{
- $old = join-path $File.DirectoryName $File.BaseName
- $new = $old+".$FTypeEnd"
- convert-file -source $old -destination $new
- cleanfile -oldfile $old -newfile $new
- } catch {
- log-functionhere -message "Error on $file.fullname"
- } finally{}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement