Skip to content

Instantly share code, notes, and snippets.

@xfirebg
xfirebg / ConvertXLS.ps1
Last active March 28, 2019 19:46 — forked from gabceb/ConvertXLS.ps1
Powershell script to convert all .xls documents to .xlsx in a folder and delete the old one(full auto)
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlOpenXMLWorkbook
write-host $xlFixedFormat
$excel = New-Object -ComObject excel.application
$excel.visible = $false
$folderpath = "D:\Users\Username\Desktop\test"
$filetype ="*xls"
Get-ChildItem -Path $folderpath -Include $filetype -recurse |
ForEach-Object `
{
$path = ($_.fullname).substring(0, ($_.FullName).lastindexOf("."))