Page 1 of 2

Sync Browse - auto create subfolder

Posted: 09 Jun 2021 10:28
by moritz.glaesle
Hi there.
I love the "Sync Browse" feature. Although i miss a way to automatically create a subfolder that i'm diving into, on the other side, if it doesn't exist. i have to first create the folder manually, then can continue sync-browsing. FileZilla has this feature and i use it all the time when just copying single files but keep complex folder structures intact on both sides.

Is this possible? Or is it possible to do via scripting? I'd appreciate any help.

thanks,
Moritz.

Re: Sync Browse - auto create subfolder

Posted: 09 Jun 2021 11:04
by highend
It's possible via a script for Custom Event Actions - Changing Locations - After painting the file list

Set the action to "Run script" and in the script column use this:

Code: Select all

    $syncBrowse = get("#814");
    $dualPane   = get("#800");

    if ($syncBrowse && $dualPane) {
        $aPaneFolders = listpane("a", , 2+4, <crlf>);
        $iPaneFolders = listpane("i", , 2+4, <crlf>);
        $aPaneMissing = formatlist($iPaneFolders, "F", <crlf>, "!$aPaneFolders");
        $iPaneMissing = formatlist($aPaneFolders, "F", <crlf>, "!$iPaneFolders");

        if ($aPaneMissing) {
            $dstPath = get("path", "a");
            foreach($folder, $aPaneMissing, <crlf>, "e") {
                if (exists("$dstPath\$folder") != 2) {
                    new($dstPath . "\" . $folder, "dir");
                    // sysdebug "a: " . $dstPath . "\" . $folder;
                }
            }
            refreshlist "a";
        }
        if ($iPaneMissing) {
            $dstPath = get("path", "i");
            foreach($folder, $iPaneMissing, <crlf>, "e") {
                if (exists("$dstPath\$folder") != 2) {
                    new($dstPath . "\" . $folder, "dir");
                    // sysdebug "i: " . $dstPath . "\" . $folder;
                }
            }
            refreshlist "i";
        }
    }
This should work, although I've done only limited testing...

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 12:27
by moritz.glaesle
Thanks for the answer!

Although it's not quite what i had in mind. Your script creates all folders that don't exist on the other side after diving into a folder. What i'm looking for is a way to create a folder before i dive into it, if it doesn't exist on either side. Hope this explanation makes sense.

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 12:30
by highend
Nope. Give a real world example

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 14:23
by klownboy
I'm guessing, but if moritz.glaesle would like only the selected folder in in one pane to be created in the other pane, that might make it easier to script.

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 17:46
by moritz.glaesle
real world example:

left pane shows folders A, B, C
right pane shows folders A, B

click on C in left pane to dive into it. before the dive, an empty folder C is created in the right pane, then both panes enter their folder C, so browsing is still in sync. left side shows content of folder C, right pane shows empty folder C.

thanks for your help guys.

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 18:06
by admin
I like and use FileZilla myself, so it cannot be such a bad idea. I checked it and saw that there is a prompt before anything happens:
2021-06-10_180356.png
2021-06-10_180356.png (5.86 KiB) Viewed 1379 times
XYplorer does not need the second option (the disabling part) so it should just ask whether to create the dir, okay?

Or would it be cooler to add a general option: Configuration | Tabs and Panes | Dual Pane | Sync Browse auto-creates any missing folder ?

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 18:15
by moritz.glaesle
actually i wish filezilla had an option in preferences to turn that dialog off, so it would just create the folder without asking questions. some people might like the warning though.

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 18:18
by admin
So let's do it like I attached it at the end of my post. My preference as well.

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 18:20
by Horst
admin wrote: 10 Jun 2021 18:06 I like and use FileZilla myself, so it cannot be such a bad idea. I checked it and saw that there is a prompt before anything happens:
2021-06-10_180356.png
XYplorer does not need the second option (the disabling part) so it should just ask whether to create the dir, okay?

Or would it be cooler to add a general option: Configuration | Tabs and Panes | Dual Pane | Sync Browse auto-creates any missing folder ?
I would prefer the question if the missing dir should be created.
Its not a big risk to also have a general option.

Re: Sync Browse - auto create subfolder

Posted: 10 Jun 2021 18:47
by admin
That would make it more complex because there would be three ways (and one checkbox is not enough):
1) just go into that one folder (as it's done now, and I want to keep this option)
2) always create missing folder (new general option)
3) ask each time

Re: Sync Browse - auto create subfolder

Posted: 11 Jun 2021 06:05
by moritz.glaesle
This would make it a general option "Sync Browse auto-create missing folders" (on/off), with the sub-option "ask before create" (yes/no). sounds good to me. and not too complex.

Re: Sync Browse - auto create subfolder

Posted: 11 Jun 2021 08:40
by admin
moritz.glaesle wrote: 11 Jun 2021 06:05 This would make it a general option "Sync Browse auto-create missing folders" (on/off), with the sub-option "ask before create" (yes/no). sounds good to me. and not too complex.
Not too complex but maybe not too necessary. I assume after you've seen this prompt more than two times you have enough of it and turn it off anyway. And it would have to be a 3-way prompt (not too nice for the brain):
Yes: create
No: don't create but go
Cancel: do nothing

ATM I'd rather keep it as simple as it is now. Sync Browse should be a smooth experience.

Re: Sync Browse - auto create subfolder

Posted: 11 Jun 2021 10:16
by eil
i'd say prompt is not needed, but an indicator(smth like a line when filters are used) would be good, 'cause as i understand this sync-view mod works only when in 2 panel mode, so easily can be forgotten to be On if switched to 1 panel and much later again back to 2.

Re: Sync Browse - auto create subfolder

Posted: 11 Jun 2021 11:57
by Horst
eil wrote: 11 Jun 2021 10:16 i'd say prompt is not needed, but an indicator(smth like a line when filters are used) would be good, 'cause as i understand this sync-view mod works only when in 2 panel mode, so easily can be forgotten to be On if switched to 1 panel and much later again back to 2.
I guess most users which are using 2 panes doing that most of the time
and will never forget that they have switched on this feature.
Why should I ever want to switch it off ?