Finding Zero Kb files from the files directory
TestingDriveThru: Challenge from last week and How I dealt with it.
Challenge: Finding Zero Kb files from the files directory
Challenge: Finding Zero Kb files from the files directory
- Windows+R = Run : Enter "Powershell" and Hit Enter
- It opens the Powershell
- It shows Current directory: PS C:\Users\srinivas.kadiyala>
- Navigate to the directory where files are stored and where we want to find Zero Kb Files.
- Use command: CD C:\Users\srinivas.kadiyala\Downloads\FolderTest\ and Hit Enter
- Now Current directory will be: C:\Users\srinivas.kadiyala\Downloads\FolderTest>
- Now copy the below script and Hit Enter:
Below scripts helps you to find files with zero file size.
Get-Childitem -Recurse | foreach-object { if(!$_.PSIsContainer -and $_.length -eq 0) { write-host (“{0} -> {1}” -f $_.FullName, $_.Length) } }
Result: It will display files which has 0kb.
C:\Users\srinivas.kadiyala\Downloads\FolderTest>DocumentTest.docx -> 0
This can reduce the testing time.