Multi Rename Tool. Is there a GREAT Grandparent directory?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
brian
Junior Member
Junior Member
Posts: 61
Joined: 2003-09-25, 01:14 UTC
Contact:

Multi Rename Tool. Is there a GREAT Grandparent directory?

Post by *brian »

That was pretty much the question.... I know there's a parent [p] and grandparent [g] but [gg] did not work. What is the code to use for a great grandparent directory in the rename tool?
We call it WindowsCommander because it commands Windows, not "Total".
even though it'd be cool to command a 7 trillion dollar oil company
It won Best Alternative File Manager
http://polldaddy.com/poll/810222/
First comment = my girl! ;)
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Multi Rename Tool. Is there a GREAT Grandparent directory?

Post by *Dalai »

I don't think there is. Maybe a plugin has such field?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

MRT: GREAT GRAND Grand parent folder (hierarchy top level deep grant grandfather)

Post by *Stefan2 »

You can use the "build-in" plugin 'tc' with its property 'path':
Result: c:\Windows\System32\DriverStore\drvindex.dat


Next use syntax as described in the Help >> [N2-5] Characters 2 to 5
[=tc.path:3-10] [N]
and also Search: \ Replace: ~
Result: Windows drvindex.dat

- -

Or use a Script-Plugin where you can execute a VBScript and get the result for to use as CustomColumn and in MRT.
"Script Content Plugin" https://www.ghisler.ch/board/viewtopic.php?p=68714
"WinScript Advanced Content Plugin" http://ghisler.ch/board/viewtopic.php?t=44032

Example script

Code: Select all

'///  https://ghisler.ch/board/viewtopic.php?p=354247#p354247
' Re: Multi Rename Tool. Is there a GREAT Grandparent directory?



'// ==============================================================
'*** Script for Script Content Plugin 0.2
'*** http://www.totalcmd.net/plugring/script_wdx.html
'*** http://wincmd.ru/plugring/script_wdx.html
'*** In default var "filename" is the current file incl. full path

'// Nach Installation im Installationsverzeichnis des Plugins eine Datei namens "NameOfMyScript.vbs" mit dem gewünschten Scriptcode anlegen.
'// After installation create a file "NameOfMyScript.vbs" in the plugin installation folder with the wanted script code.
'-----------------------------
'
'// "Script Content Plugin"-Basics:
'	"filename" is a build-in variable to hold the current processed full filename (D:\Rive\Path to\file name.ext).
'	Example: filename equals e.g. "c:\Python 3.1\Tools\versioncheck\py version check.py"
'-----------------------------
'
'// Use VBS-code to do something to that "filename".
'    Example code:
'      strFullName = filename
'    	'MsgBox "Current FullName: " & strFullName
'      
'      strPath = left(strFullName, InstrRev(strFullName, "\") -1)
'    	'MsgBox "Path: " & strPath
'      
'      strParent = mid(strPath , InStrRev(strPath, "\") +1)
'    	'MsgBox "Parent folder: " & strParent
'      
'      strName = mid(strFullName, InstrRev(strFullName, "\") +1)
'    	'MsgBox "Name: " & strName
'      
'      If InStr(strName, ".") Then
'        strBase = left(strName, InstrRev(strName, ".") - 1 )
'        strExte = mid( strName, InstrRev(strName, ".") + 1 )
'    		'MsgBox "Base: " & strBase & "  <DOT>  " & strExte
'      End If
'-----------------------------
'
'// Use "content=", "content1=" and up to "content9=" to store the wanted script result.
'Example:
'content  = strExte   ' use [=script.Result] 
'content1 = strPath   ' use [=script.Result1] 
'content2 = strName   ' use [=script.Result2]
'...
'content9 = "" 			' use [=script.Result9]
'-----------------------------
'
'// Um dieses Skript zu verwenden, editiere die script.ini:
'// To use this script, modify the script.ini:
 '[Script]
 'Section=NameOfMySection
'
 '[NameOfMySection]
 'LongName=0
 'ParseDirs=1
 'Script=NameOfMyScript.vbs
'-----------------------------
'
'// In TC verwende "[=script.Result]", "[=script.Result1]" bis zu "[=script.Result9]"
' im MultiUmbenennTool oder für Benutzerdefinierte Spalten.
'// In TC use "[=script.Result]", "[=script.Result1]" and up to "[=script.Result9]"
'in MultirenameTool or user defined CustomCulumns.
'// ==============================================================
'// ==============================================================
'// ==============================================================


'// Dedicated example script for: Multi Rename Tool. Is there a GREAT Grandparent directory?

'// Get Level of directory paths:

		Set FSO = CreateObject("Scripting.FileSystemObject")
		sFullName = filename
		If(Right(sFullName,1)= "\") Then 		' It's a folder (TC add trailing backslash)
			Set oItem 			= FSO.GetFolder(sFullName)
		Else									' It's a file
			Set oItem 			= FSO.GetFile(sFullName)
		End If        
		iFileCount = iFileCount + 1
        sName   = FSO.GetFileName(oItem)		' "File.txt"
        sBase   = FSO.GetBaseName(oItem)		' "File"
        sExte   = FSO.GetExtensionName(oItem)	' "txt" (no dot)
		sDrive  = FSO.GetDriveName(oItem)		' "X:"
		'------------------------------------------------------
		sPath   = FSO.GetParentFolderName(oItem)
		'sPath   = oItem.ParentFolder
		
		aPathParts = split(sPath, "\")
		iUBound = UBound(aPathParts)
							  sParentFolder1 = aPathParts(iUBound)
		If (iUBound > 0) Then sParentFolder2 = aPathParts(iUBound -1)
		If (iUBound > 1) Then sParentFolder3 = aPathParts(iUBound -2)
		If (iUBound > 2) Then sParentFolder4 = aPathParts(iUBound -3)
		If (iUBound > 3) Then sParentFolder5 = aPathParts(iUBound -4)
		If (iUBound > 0) Then sTopFolder1  	 = aPathParts(1)
		If (iUBound > 1) Then sTopFolder2 	 = aPathParts(2)
		If (iUBound > 2) Then sTopFolder3 	 = aPathParts(3)
		
		
		strParentDir = sParentFolder1
		strGrandPaDir = sParentFolder2
		strGtGrandPaDir = sParentFolder3
		sGtGtGrandPaDir = sParentFolder4
		sGtGtGtGrandPaDir = sParentFolder5
		
		'oItem.DateCreated	
		'oItem.DateLastAccessed
		'oItem.DateLastModified



'//Give the result(s) back to TC
content  = strParentDir  				 ' use [=script.Result]  in TC and remove [E] from extension field
content1 = strGrandPaDir                 ' use [=script.Result1] in TC
content2 = strGtGrandPaDir               ' use [=script.Result2]
content3 = sGtGtGrandPaDir
content4 = sGtGtGtGrandPaDir
content9 = ""

'Example:
'For file: c:\Windows\System32\DriverStore\drvindex.dat
'[=script.Result2] # [=script.Result1] # [=script.Result] # [N]
'Result: Windows # System32 # DriverStore # drvindex.dat

'// END
- -

Ahh, "FileX" has GtGrandPaDir: [=filex.GtGrandPaDir]

[=filex.GtGrandPaDir] # [=filex.GrandPaDir] # [=filex.ParentDir] # [N]
Result: Windows # System32 # DriverStore # drvindex.dat

https://totalcmd.net/plugring/FileX.html



- - -

More information:

Plugins for Total Commander:
http://www.ghisler.ch/wiki/index.php/Plugin
>>> Content plugins (.wdx files)

FAQs: Installing/Removing a plugin is just this:
viewtopic.php?p=294671#p294671

HTH?
User avatar
brian
Junior Member
Junior Member
Posts: 61
Joined: 2003-09-25, 01:14 UTC
Contact:

Re: Multi Rename Tool. Is there a GREAT Grandparent directory?

Post by *brian »

Eeeeeh..... WHAT???????
We call it WindowsCommander because it commands Windows, not "Total".
even though it'd be cool to command a 7 trillion dollar oil company
It won Best Alternative File Manager
http://polldaddy.com/poll/810222/
First comment = my girl! ;)
Post Reply