Jump to content

Auto-creating .txtp for all files in root directory


Go to solution Solved by AlphaTwentyThree,

Recommended Posts

  • Engineer

Hey folks, I'm trying to auto-create .txtp files in a root directory that reference all files inside the root folder structure. Currently trying with QuickBMS and I'm searching for a command that parses a string of a file with preceding path into just the file name, so `.\root\USRDIR\VFS\Music\101menu.at3` > `101menu.at3`.

Tried to call getCT on the string, but it prints out an error as the script tries to read data from the file the script is called upon (which is just a dummy, the script should only process the file structure in the current directory).
Maybe it's easier to actually do this with a batch file? Anyone has suggestions on how to achieve what I need in the easiest way?

Example for clarity

Let's say I have a structure in he following form:

root\SND0.AT3
root\USRDIR\VFS\Music\1.at3
root\USRDIR\VFS\Music\101menu.at3
root\USRDIR\VFS\Music\2.at3
root\USRDIR\VFS\Music\3.at3
root\USRDIR\VFS\Music\4.at3
root\USRDIR\VFS\Videos\Diver_NlSubs.oma
root\USRDIR\VFS\Videos\DJGirl_NlSubs.oma
root\USRDIR\VFS\Videos\ivolg.oma
root\USRDIR\VFS\Videos\nord.oma

All those files should stay within their respective structure.
Now I want to have one txtp per file, for example `101menu.txtp` with the content `root\USRDIR\VFS\Music\101menu.at3`. That goes for all the files in the folder structure.
I could either run a quickBMS script on an arbitrary file in the root directory or place a batch file there that does the job.

Link to comment
Share on other sites

1 hour ago, AlphaTwentyThree said:

Hey folks, I'm trying to auto-create .txtp files in a root directory that reference all files inside the root folder structure. Currently trying with QuickBMS and I'm searching for a command that parses a string of a file with preceding path into just the file name, so `.\root\USRDIR\VFS\Music\101menu.at3` > `101menu.at3`.

Tried to call getCT on the string, but it prints out an error as the script tries to read data from the file the script is called upon (which is just a dummy, the script should only process the file structure in the current directory).
Maybe it's easier to actually do this with a batch file? Anyone has suggestions on how to achieve what I need in the easiest way?

Example for clarity

Let's say I have a structure in he following form:

root\SND0.AT3
root\USRDIR\VFS\Music\1.at3
root\USRDIR\VFS\Music\101menu.at3
root\USRDIR\VFS\Music\2.at3
root\USRDIR\VFS\Music\3.at3
root\USRDIR\VFS\Music\4.at3
root\USRDIR\VFS\Videos\Diver_NlSubs.oma
root\USRDIR\VFS\Videos\DJGirl_NlSubs.oma
root\USRDIR\VFS\Videos\ivolg.oma
root\USRDIR\VFS\Videos\nord.oma

All those files should stay within their respective structure.
Now I want to have one txtp per file, for example `101menu.txtp` with the content `root\USRDIR\VFS\Music\101menu.at3`. That goes for all the files in the folder structure.
I could either run a quickBMS script on an arbitrary file in the root directory or place a batch file there that does the job.

You can use the SET command in QuickBMS to process the original string, like this:

String TEST = "abc\def\ghi.test"

Set FILENAME fullname TEST
Print %FILENAME%

Set FILENAME filename TEST
Print %FILENAME%

Set FILENAME basename TEST
Print %FILENAME%

 

Your output for those 3 commands will be:

abc\def\ghi.test
ghi.test
ghi

 

 

 

Link to comment
Share on other sites

If i understand it right, do you want extract all files from a folder and sub folders to a unique folder?

you can use this commando .bat

 

@echo off
setlocal enabledelayedexpansion

set "sourceFolder=.\root"  REM Update this to your root folder path
set "destinationFolder=.\separate_folder"

if not exist "%destinationFolder%" mkdir "%destinationFolder%"

for /r "%sourceFolder%" %%i in (*) do (
    set "fullPath=%%i"
    set "fileName=%%~nxi"
    set "destinationPath=%destinationFolder%\!fileName!"

    move "!fullPath!" "!destinationPath!" > nul
)

echo Files moved successfully.

endlocal


This should take all your files of any folder and put into one determined by you

Link to comment
Share on other sites

  • Engineer
  • Solution

Conversed with ChatGPT for waaaay too long until I realized that I should only use it till a certain point and do the rest myself.

I've attached two batch files. Both create .txtp files with one reference each, ignoring certain unwanted extensions.

  • !txtp.bat - to be used if a folder structure does not contain any two files with the same name in different folders
  • !txtp_folders.bat
    • to be used if there a duplicate file names
    • name of the txtp files contains the complete relative path with `\` substituted by `~`
    • used as a basis for rips for hcs64, renaming will be required

txtp.7z

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...