Page 1 of 2

[Solved]How to make "sub excluded" copy?

Posted: 22 Jan 2021 17:33
by eil
this probably could better suit scripting forum, but as for now i only ask theoretically i think it's proper here.
so, is it possible to make copy operation excluding something in sub? for example i selected several folders and want to exclude some items from subs of folders for coping process:

Code: Select all

[aaa] ->copy full
[bbb] ->copy excluding
    [bb1] ->!no copy
    [bb2] ->copy full
    [bb3] ->copy excluding
        b11.file ->copy
        b12.file ->copy
        b13.file ->!no copy
is it possible at all and what could be the structure of commands/algorithm?

Re: How to make "sub excluded" copy?

Posted: 22 Jan 2021 17:37
by highend
Get everything via quicksearch() and then apply your logic of exclusions via formatlist / regexreplace?

Re: How to make "sub excluded" copy?

Posted: 22 Jan 2021 17:46
by eil
main question is wouldn't such edited "list of items" become "flat" later? i still need [bb3] "to be copied" to target location and its not-excluded items too..
that's what i can't figure out: if there is some more or less smart way for this, or it involves "one by one copy" with lots of recursion and scripted creation of folders that have excluded subs?

Re: How to make "sub excluded" copy?

Posted: 22 Jan 2021 17:54
by highend
I don't get it.

You get the full list of all existing files and folders by quicksearch() and then exclude whatever you want either by either full folder name or exact files names (with path).

Afterwards you use copyto() with flags=2 and that does create necessary folders if required.

Re: How to make "sub excluded" copy?

Posted: 22 Jan 2021 18:00
by eil
highend wrote: ↑22 Jan 2021 17:54 Afterwards you use copyto() with flags=2 and that does create necessary folders if required.
thanks for hint, will experiment on that.

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 09:40
by eil
need help with understanding what i'm missing. $a gets proper list, without excluded items, but Copyto copies All items.. it can't copy by variable list? need cycle use to copy one-by-one?..

Code: Select all

$a = inputselect( , "+" . quicksearch( , <selitems |>,"|+"), "|", 1 + 2 + 32 + 64);
  copyto inputfolder( , "Select Folder"), $a, <curpath>, 2, 1, 1, 1, , , , , 1

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 10:38
by highend
And you've really deselected folder entries and the files you don't want to copy in the inputselect dialog?
Otherwise... Ofc it copies everything if folder entries are selected...

Inside a script: You'd either need to do the $a without folders at all (= missing context) or filter folders out afterwards (which is easy as long as the final part of them doesn't contain a dot)...

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 11:05
by eil
highend wrote: ↑24 Jan 2021 10:38 And you've really deselected folder entries and the files you don't want to copy in the inputselect dialog?
yep, screen for example.
2021-01-24_131043.png
add:
highend wrote: ↑24 Jan 2021 10:38 Inside a script: You'd either need to do the $a without folders at all (= missing context) or filter folders out afterwards (which is easy as long as the final part of them doesn't contain a dot)...
first i didn't understand, then after couple experiment got it - the problem is that it has folders as a separate "item", and copy happens twice(excluded list and whole folder). is there easy way to clear list of folders, or only with cycle?

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 11:11
by highend
H:\Shrift is selected -> Everything inside it will be copied...

The 100% foolproof way? Either use quicksearch with /f (= missing context) or do the quicksearch with /d a second time, escape meta chars and remove all of them with one regex

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 11:33
by eil
highend wrote: ↑24 Jan 2021 11:11 Either use quicksearch with /f (= missing context) or do the quicksearch with /d a second time
these switches are used with Quick Search interface, how to incorporate them in script?(goto + variable?)

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 11:36
by highend
In the same way as in the gui for it
quicksearch([query="*"], [path], [separator="<crlf>"], [flags])

query [optional] Search pattern, can have switches.
Defaults to "*" (match all).

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 11:57
by eil
now i got everything tuned and working, thanks.)
should i add topic to script branch with working variant?

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 12:01
by highend
It belongs to this thread, so do it here

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 13:22
by eil
unexpected turn in script polishing. is there some non-cycle method to sort list of items by path?(SortByList and FormatList doesn't seem to handle this)
so instead of= c:\2\22\2.txt | c:\1 | c:\2\2.txt | c:\0.txt
i get smt like= c:\0.txt | c:\1 | c:\2\2.txt | c:\2\22\2.txt

and additional question(if there is a way), will "+" on beginning of some items in list interfere sorting?( like c:\2\22\2.txt | +c:\1 | c:\2\2.txt | +c:\0.txt

Re: How to make "sub excluded" copy?

Posted: 24 Jan 2021 13:29
by highend
And why do you think that formatlist() doesn't handle this?
and of course with a leading char it wouldn't return what's expected...