Identify Un-Used Files in ORTS Routes with DDS Textures

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PerryPlatypus
    Senior Member

    • Jun 2009
    • 951
    • Spokane, WA
    • English
    • MSOR

    #1

    Identify Un-Used Files in ORTS Routes with DDS Textures

    Has anyone managed to develop a tool and/or a solid method of identifying un-used files in ORTS routes that depend heavily on DDS format Textures and Terrtex? Back in MSTS days Route Riter could be used for this purpose, but with shapes files pointing to DDS textures, Tiles pointing to DDS Terrtex files, etc., this seems to no longer be possible.

    I have attempted to use Windows built-in "Date Accessed" file property as a way of checking this (by running ORTS and seeing which files do not have the Date Accessed property update), but the property seems entirely inconsistent and un-usable, no matter how I change the Registry value for the way "Date Accessed" functions. Sometimes the Date Accessed does not update at all, other times it updates for all of the files just by opening a folder and not even viewing any files.

    If anyone knows of a method, third party program, etc. that can identify all files in a folder that are used by a particular program (or the contrast - identifying all files in a folder that are NOT used by a program), please advise.
    ~Sean Kelly~
    SP Shasta Route for Open Rails: https://www.trainsimulations.net/sp-shasta​
    MRL Mullan Pass for Open Rails: https://www.trainsimulations.net/mullanpass
  • pwillard
    3000 Post Veteran



    • Nov 1999
    • 3071
    • Cumming Ga
    • ORTS

    #2
    In a Windows file system, the "last accessed" timestamp *should* indicate the last time the file was opened, or executed without changing it. Personally, though, I've never trusted it but that's probably due to a lack of a need to rely on it rather than actual knowledge on my part. It's weird hearing someone confirm it doesn't actually work though.

    If someone does take on the task of writing such a utility I BEG that they write it in a scripting language to share the source code. I'm so sick of having tools that now barely (or no longer) work due to the passage of time and therefore are affected by changes in operating systems and lack of available dependencies.

    I mean, it shouldn't be hard to do what you want though.

    For grins and giggles with my morning coffee... I created a crude test scenario.

    ../Microsoft Games/Train Simulator/routes/USA1

    My result:

    Code:
    PS D:\Programs\Microsoft Games\Train Simulator\ROUTES\USA1> code test.ps1
    PS D:\Programs\Microsoft Games\Train Simulator\ROUTES\USA1> pwsh test.ps1
    
    Enter the folder path:: textures
    Enter the number of days threshold for recent access:: 30
    
    File 'D:\Programs\Microsoft Games\Train Simulator\ROUTES\USA1\Textures\US2Refinery.ace' was accessed 1 day(s) ago.
    PS D:\Programs\Microsoft Games\Train Simulator\ROUTES\USA1>​
    But you know what? I know I was reading more than just that one recently, I was also looking at the seasonal ACEs as well. So I see your point seeming unreliable.

    My code below is CRUDE and took less than 2 sips of coffee so maybe it just needs more thought.

    Code:
    $folderPath = Read-Host "Enter the folder path:"
    $daysThreshold = Read-Host "Enter the number of days threshold for recent access:"
    $now = Get-Date
    $cutOffDate = $now.AddDays(-$daysThreshold)
    $fileList = Get-ChildItem -Path $folderPath -Recurse | Where-Object {!$_.PSIsContainer}
    foreach ($file in $fileList) {
        $lastAccessTime = $file.LastAccessTime
        if ($lastAccessTime -gt $cutOffDate) {
            $daysSinceAccess = ($now - $lastAccessTime).Days
            Write-Host "File '$($file.FullName)' was accessed $daysSinceAccess day(s) ago."
        }
    }
    ​
    http://www.railsimstuff.com
    Just Blender now, 3DCrafter only when I have to.
    Formerly The Keystone Works (All Permissions Granted)
    Things I work on: https://github.com/pwillard

    Comment

    Working...