Powershell script scan folders and subfolders and list details about files RRS feed

  • General discussion

  • I am trying to find a way to record all the details about my files on my server, as I have discovered that when I run my media files through Handbrake, they are losing they creation date, last used etc.

    so I have hunted around and found this script that records the information I would like, but I am having issues working out how to get it to go deeper into the folder structure and record each file. cos at the moment all it does is list the root folders.

    my folder structure looks like this

    media \ year \ locations \ Files

    I hope that someone can help me with this little problem.

    # OldTime.ps1 - Start

    . .\OldTime-record.ps1

    for($i = 0; $i -lt $file.count; $i++) {

        write-output "$($file[$i])"

        write-output "$($time[$i])"   

    Set-ItemProperty -Path $($file[$i]) -Name CreationTimeUTC -Value $($time[$i])   

    Set-ItemProperty -Path $($file[$i]) -Name LastWriteTime -Value $($time[$i]) }

    # OldTime.ps1 - End


    • Edited by Chambersuk Friday, August 16, 2019 1:20 PM
    • Changed type Bill_Stewart Tuesday, September 24, 2019 6:21 PM
    • Moved by Bill_Stewart Tuesday, September 24, 2019 6:21 PM Unanswerable drive-by question
    Friday, August 16, 2019 1:18 PM

All replies

  • As noted in the very first post in the top of this forum:

    This forum is for scripting questions rather than script requests

    The bit of script you posted will show an error if you don't have a script named "OldTime-Record.ps1" in the same directory as the "OldTime.ps1" script. The script appears to set file times, but it is not clear what you want to accomplish.

    There's not really any way we can guess at what you want to do based on a vague description and some code that doesn't seem do have anything to do with the question.

    -- Bill Stewart [Bill_Stewart]

    Friday, August 16, 2019 1:36 PM