Sorry i am newbie. i only know how to copy/move/delete files using powershell. it will be really helpful if someone can help me in this matter and please excuse my english.
I have multiple sub folders, lets say
C:\test\1
C:\test\2
C:\test\3
inside the folder there is multiple image files. i want to list the sub folder's file name and size and save text files inside the subfolders.
C:\test\1\filelist.txt
C:\test\2\filelist.txt
C:\test\3\filelist.txt
filelist.txt will have something like this
Image1.png 30kb
Image2.png 4MB
Here is a sample script i found from online but i need it to save text file in subfolders based on subfolder file names.
$Folder = 'C:\pic'
$Output = 'C:\output.txt'
$Files = Get-ChildItem -Path $Folder -Filter *.png -File
$objShell = New-Object -ComObject Shell.Application
$objFolder = $objShell.Namespace($Folder)
foreach( $File in $Files ) {
$objFile = $objFolder.ParseName($File)
$Name = $objFolder.GetDetailsOf($objFile, 0)
$Size = $objFolder.GetDetailsOf($objFile, 1)
$Length = $objFolder.GetDetailsOf($objFile, 27)
$Tab = [char]9
"$Name$Tab$Size$Tab$Length" | Out-File -Append -FilePath $Output
}
```