DISQUS

DISQUS Hello! Tech-Recipes is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Tech-Recipes

Cookbook of Tech Tutorials
Jump to original thread »
Author

PowerShell: Quick Way to Check for a File Type on a Drive or Directory | Windows | Tech-Recipes

Started by qdideas · 9 months ago

No excerpt available. Jump to website »

2 comments

  • Can this be done recursively? In other words, can I test-path for all files in the path and every subdirectory of the path?

    btw, thanks for a great blog.
  • does it have to be powershell? without installing powershell, you can use vbscript
    Set objFSO = CreateObject("Scripting.FilesyStemObject")
    myFolder="c:"
    Set objFolder = objFSO.GetFolder(myFolder)
    GoSubFolders objFolder

    Sub GoSubFolders (objDIR)
    If objDIR <> "System Volume Information" Then
    MainSub objDIR
    For Each eFolder in objDIR.SubFolders
    GoSubFolders eFolder
    Next
    End If

    End Sub

    Sub MainSub (objDIR)
    For Each efile in objDIR.Files
    WScript.Echo "File ", eFile, "is a ", eFile.Type
    Next
    End Sub


    save it as .vbs extension, type cscript myscript.vbs

Add New Comment

Returning? Login