Elvas Tower: Route Texture Folder Utility - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Route Texture Folder Utility Rate Topic: -----

#1 User is offline   Slim Rail Mike 

  • Conductor
  • Group: Status: First Class
  • Posts: 262
  • Joined: 04-May 08
  • Gender:Male
  • Location:Sonoma, California
  • Simulator:MSTS-OR
  • Country:

Posted 13 January 2019 - 08:24 PM

This looks like the spot to ask this question.

Is there a program that can find all the unused / orphaned Textures in a route? RR can find textures used by a shape one at a time. But what I want is to find those not used.Something to find the textures and compare the 'found' list to the total list of textures.

If not, is there a not too tedious technique?
Thax


Michael

#2 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,341
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 13 January 2019 - 09:16 PM

In Windows Explorer you can display Date_Accessed in any directory. Set that to display then run the whole length of the route. Afterwards sort the file listing by that attribute. Any file not accessed on the same date is probably not used so cut and paste those elsewhere. Next run route riter and have it tell you if anything needed is missing.

#3 User is offline   Slim Rail Mike 

  • Conductor
  • Group: Status: First Class
  • Posts: 262
  • Joined: 04-May 08
  • Gender:Male
  • Location:Sonoma, California
  • Simulator:MSTS-OR
  • Country:

Posted 13 January 2019 - 10:12 PM

Thax Dave,
That sounds simple enough for even me to do.http://www.elvastower.com/forums/public/style_emoticons/default/wacko.gif
Michael

#4 User is offline   QJ-6811 

  • Conductor
  • Group: Status: Active Member
  • Posts: 385
  • Joined: 27-December 15
  • Gender:Male
  • Simulator:MSTS / Open Rails
  • Country:

Posted 13 January 2019 - 11:34 PM

Hi Michael,

A simple way to search ... (also try it :) ). But do not forget a night ride or a winter / snow ride. And finally also look at "missing files" in the log-file.

Roger

#5 User is offline   Slim Rail Mike 

  • Conductor
  • Group: Status: First Class
  • Posts: 262
  • Joined: 04-May 08
  • Gender:Male
  • Location:Sonoma, California
  • Simulator:MSTS-OR
  • Country:

Posted 14 January 2019 - 09:37 AM

Hi Roger,
Thank you for that,
Yes, The other folders would need the unused files pulled too. I am thinking that once the files from the main TEXTURES folder have been separated, I could use the removed files as a list the find and remove the night/winter files. If the unused files are trees then all the seasonal folders would be checked too.
Michael

#6 User is offline   scottb613 

  • Vice President
  • Group: Status: First Class
  • Posts: 2,973
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 14 January 2019 - 10:31 AM

Hi Folks,

I do it with UNIX Shell scripts - pretty handy... I'm not a real programmer - just stayed in a Holiday Inn Express last night... I open all the world tiles to get a definitive list of textures used...
:derisive:



#!/bin/bash
declaration () {
        #ROUTE="Tristate_Rails 3-1-13"
        ROUTE="L&HR_1940"
        TEMP="${HOME}/tmp"
        LOG=${TEMP}/mooterlog.txt
        MSTSPATH="/cygdrive/c/Program Files (x86)/Microsoft Games/Train Simulator"
        DOSMSTSPATH="c:\Program Files (x86)\Microsoft Games\Train Simulator"
        WORKDIR="/home/N63503/TERTEXTEMP"
        DOSWORKDIR="C:\cygwin\home\N63503\TERTEXTEMP"
        TILES="${MSTSPATH}/Routes/${ROUTE}/Tiles"
        DOSTILES="${DOSMSTSPATH}\Routes\\${ROUTE}\Tiles"
        WORLD="${MSTSPATH}/Routes/${ROUTE}/World"
        DOSWORLD="${DOSMSTSPATH}\Routes\\${ROUTE}\World"
        TERRTEX="${MSTSPATH}/Routes/${ROUTE}/Terrtex"
        LLISTUSED=${TEMP}/llistused.txt
        LLISTTEXT=${TEMP}/llistace.txt
        LLISTDELT=${TEMP}/llistdel.txt
}
uncomp () {
        cd "${WORKDIR}"
        echo "Cleaning working directory..." | tee -a ${LOG}
        rm "${WORKDIR}"/* 2>/dev/null
        echo "Start decompression T files - ${ROUTE}..." | tee -a ${LOG}
        java TSUtil fmgr -t -e -o "${DOSTILES}" "${DOSWORKDIR}" | tee -a ${LOG}
        echo "DOS to UNIX conversions..." | tee -a ${LOG}
        dos2unix `ls ${WORKDIR}/*` 2>>${LOG}
}
findacetext () {
        echo "Find ACE textures..." | tee -a ${LOG}
        rm ${LLISTTEXT}
        cd "${TERRTEX}"
        ls *.ace | sort | uniq > ${LLISTTEXT}
}
findaceused () {
        echo "Find ACE used on route..." | tee -a ${LOG}
        rm ${LLSITUSED} 2>/dev/null
        cd "${WORKDIR}"
        for FILE in `ls`
        do
            FILE1=`echo ${FILE} | sed s/-//g`
            echo "Moving ${FILE} to ${FILE1}" | tee -a ${LOG}
            mv "${WORKDIR}/${FILE}" "${WORKDIR}/${FILE1}"
            grep "terrain_texslot " ${FILE1} | cut -d"\"" -f2 >> ${LLISTUSED}
        done
        cat ${LLISTUSED} | sort | uniq > ${LLISTUSED}.tmp
        mv ${LLISTUSED}.tmp ${LLISTUSED}
}
comparelist () {
        echo "Start file list comarison..." | tee -a ${LOG}
        rm ${LLISTDELT} 2>/dev/null
        for TEXT in `cat ${LLISTTEXT}`
        do
            grep ${TEXT} ${LLISTUSED} 2>/dev/null
            if [ ${?} -ne 0 ]
            then
                echo "${TEXT}" >> ${LLISTDELT}
                echo "${TEXT} not used..." | tee -a ${LOG}
            fi  
        done
}  
deletefiles () {
        echo "Start removing unused TERRTEX..." | tee -a ${LOG}
        cd "${TERRTEX}"
        COUNT=`ls | wc -l`
        echo "TERRTEX FILE COUNT - START - ${COUNT}" | tee -a ${LOG}
        for TEXT in `cat ${LLISTDELT}`
        do
            echo "Removing ${TEXT}" | tee -a ${LOG}
            rm ${TEXT}
        done
        COUNT=`ls | wc -l`
        echo "TERRTEX FILE COUNT - END - ${COUNT}" | tee -a ${LOG}
}
deletesnow () {
        echo "Start removing unused SNOW..." | tee -a ${LOG}
        cd "${TERRTEX}/Snow"
        COUNT=`ls | wc -l`
        echo "SNOW FILE COUNT - START - ${COUNT}" | tee -a ${LOG}
        for TEXT in `cat ${LLISTDELT}`
        do
            echo "Removing SNOW ${TEXT}" | tee -a ${LOG}
            rm ${TEXT}
        done
        COUNT=`ls | wc -l`
        echo "SNOW FILE COUNT - END - ${COUNT}" | tee -a ${LOG}
}  
   
###START###
declaration
date > ${LOG}
uncomp
findacetext
findaceused
comparelist
#deletefiles
#deletesnow
date >> ${LOG}
###END####




Regards,
Scott

#7 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,341
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 14 January 2019 - 12:39 PM

Scott, that looks like coding skill to me. :sign_rockon:

What shell do you use to run that script in windows?

#8 User is offline   scottb613 

  • Vice President
  • Group: Status: First Class
  • Posts: 2,973
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 14 January 2019 - 02:41 PM

Hi Dave,

LOL - thanks - a real programmer would probably laugh and my clumsy effort...

While I can barely copy a file in a “bat” file - I’m much more comfortable and at home with UNIX...

I make models in Flight Simulator and they require a bunch of tedious text file edits after export - so I started writing scripts for that...

I came across this open source UNIX emulator called “Cygwin” - greatest thing since sliced bread in my humble opinion... It’s actually a PC program that just creates an imersive UNIX like environment for the user... They have just about every UNIX package you could think of available (C, Python, Perl, Awk/Nawk/Gawk) for it and it’s been around for many years... For home use it’s actually better than having a UNIX system - as I have access to both my UNIX environment and my PC’s file system/executables...

Here’s the link if interested (it’s free):
https://www.cygwin.com/

Regards,
Scott

#9 User is offline   Mike B 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,085
  • Joined: 18-January 13
  • Gender:Not Telling
  • Location:Pacific Time
  • Simulator:Mostly ORTS these days
  • Country:

Posted 15 January 2019 - 08:48 PM

If you can do that kind of shell work, you should be able to figure out Powershell in Windows! Note also that Win10 Pro and up have a full BASH shell available in Linux mode - but it apparently can't access all Windows controls and files.

#10 User is offline   scottb613 

  • Vice President
  • Group: Status: First Class
  • Posts: 2,973
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 16 January 2019 - 08:52 AM

View PostMike B, on 15 January 2019 - 08:48 PM, said:

If you can do that kind of shell work, you should be able to figure out Powershell in Windows! Note also that Win10 Pro and up have a full BASH shell available in Linux mode - but it apparently can't access all Windows controls and files.


Hi Mike,

Hah - yeah - but the slashes go the WRONG way !!!
:rolleyes:

I've poked around a bit and I've never come across programs on windows similar to "awk" in UNIX - since I use Cygwin a great deal to process text files - awk makes it so easy - it's a powerful programming language unto itself... I've got decades of experience with UNIX - so it's just easier to work with what I know...

Regards,
Scott

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users