Page 1 of 1

Open directly subfolder if folder is empty (recursively)

Posted: 29.04.2016, 15:12
by Uzanto de FCOMM
Hello Marek and all others,
one feature i need when i work with Java projects is the possibility to go to the first not-empty subfolder when i open an empty folder.
This would save a lot of clicks.

E.g. In Java projects (but not only Java...) I have often the following situation:
C:\workspace\project1\emptyFolder1\emptyFolder2\emptyFolder3\emptyFolder4\FolderWithFiles\Main.java

Where, as the name suggests, the emptyFolderX are folders without files, needed just to create the project structure (often the name of emptyFolder1 is "src").
Now, it would be nice if an option would allow to click on emptyFolder1 and freeCommander would automatically open all the subfolders untill he reaches:
C:\workspace\project1\emptyFolder1\emptyFolder2\emptyFolder3\emptyFolder4\FolderWithFiles\

In this situation, if user wants to go on emptyFolder3, (s)he can click on the clickable address and will reach it quite easily.
But in most of the cases, user wants to arrive to FolderWithFiles without too many clicks.

Developement tools often offer this possibility (some, as Eclipse can even group the empty folders, but in case of freeCommander this would be too much).

Re: Open directly subfolder if folder is empty (recursively)

Posted: 30.04.2016, 08:43
by afh
I would suggest SHIFT+CRTL+B and then ALT+F9.
In plain view - folder, an folder that has no files (but have subfolders) has 0 size.
Also add "Path" column to details (to see the path and sort).

Re: Open directly subfolder if folder is empty (recursively)

Posted: 02.05.2016, 09:56
by Uzanto de FCOMM
afh wrote:I would suggest...
Good workaround, I will use for sure, but still a workaround...

Re: Open directly subfolder if folder is empty (recursively)

Posted: 02.05.2016, 20:46
by afh
All you can do is to write an exe that takes %ActivSel% as cmdline parameter and then starts Freecommander.exe with /C parameter -> see http://www.freecommander.com/fchelpxe/e ... eters.html

Here is an autoit script that should do that (at least I hope... :) I'm not an expert...)
You need of course to compile the script and use the exe file.

Code: Select all

If $cmdline[0] = 0 Then Exit
$folder = $cmdline[1]
recursive($folder)
MsgBox(0,"", "No folder with files found")
Func recursive($path)
$search = FileFindFirstFile($path & "\*")
$subfolderName = ""
While 1
	$file = FileFindNextFile($search)
	If @error then	ExitLoop
	If Not @extended Then
		$cmd = "C:\PortableApps\FreeCommanderXE_HOME\FreeCommander.exe /C /L=""" & $path & """"
		Run('"' & @ComSpec & '" /c "' & $cmd & '"' , '', @SW_HIDE)
		Exit
	Else
;~ 	keep folder names for later
	$subfolderName &= $file & "|"
	EndIf
WEnd
	FileClose($search)
        If $subfolderName = "" then Return
	$name = StringSplit(StringTrimRight($subfolderName,1), "|")
	For $i = 1 to $name[0]
		recursive($path & "\" & $name[$i])
	Next
EndFunc