folder depth level search

This topic contains 2 replies, has 2 voices, and was last updated by  Biswajit 4 years ago.

  • Author
    Posts
  • #11201

    Biswajit
    Participant

    1. Below script is search which level?
    2. Need to search 20 to 30 folder depth level. Want to exclude the 1-19.
    ________________________________
    workflow media {

    Suspend-Workflow

    Checkpoint-Workflow

    $root="C:\Windows"
    $depth=6
    1..($depth+1) | foreach {$root + ("\*" * $_)} |
    Get-ChildItem |
    where {$_.Extension -match '(\.mp3\b|\.mp4\b)'
    } |

    select Directory,FullName,CreationTime,Length |

    Export-Csv media.csv

    }

  • #11202

    Dave Wyatt
    Moderator

    That's a clever way to do it. Looks like all you need to change is the array that's being piped to ForEach-Object: 20..30 instead of 1..($depth+1)

  • #11235

    Biswajit
    Participant

    Its does to stop . Still running in my test VM.
    ___________________________________

    workflow biswajit {

    Suspend-Workflow

    Checkpoint-Workflow

    $root=”C:”

    1..10 | foreach {$root + (“\*” * $_)} |
    Get-ChildItem |
    where {$_.Extension -match ‘(\.mp3\b|\.mp4\b|\.avi\b|\.m4a\b|\.m4p\b|\.m4v\b|\.mobi\b|\.mov\b|\.mpeg\b|\.mpg\b|\.vob\b|\.wav\b|\.wma\b|\.wmv\b)’
    } |

    select Directory,FullName,CreationTime,Length |

    Export-Csv D1.csv

    }

You must be logged in to reply to this topic.