Route Texture Folder Utility
#1
Posted 13 January 2019 - 08:24 PM
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
Posted 13 January 2019 - 09:16 PM
#3
Posted 13 January 2019 - 10:12 PM
That sounds simple enough for even me to do.http://www.elvastower.com/forums/public/style_emoticons/default/wacko.gif
Michael
#4
Posted 13 January 2019 - 11:34 PM
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
Posted 14 January 2019 - 09:37 AM
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
Posted 14 January 2019 - 10:31 AM
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
Posted 14 January 2019 - 12:39 PM
What shell do you use to run that script in windows?
#8
Posted 14 January 2019 - 02:41 PM
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
Posted 15 January 2019 - 08:48 PM
#10
Posted 16 January 2019 - 08:52 AM
Mike B, on 15 January 2019 - 08:48 PM, said:
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