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

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
eil
Posts: 1622
Joined: 13 Jan 2011 19:44

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

Post 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?
Last edited by eil on 26 Jan 2021 14:25, edited 1 time in total.
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to make "sub excluded" copy?

Post by highend »

Get everything via quicksearch() and then apply your logic of exclusions via formatlist / regexreplace?
One of my scripts helped you out? Please donate via Paypal

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: How to make "sub excluded" copy?

Post 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?
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to make "sub excluded" copy?

Post 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.
One of my scripts helped you out? Please donate via Paypal

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: How to make "sub excluded" copy?

Post 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.
Win 7 SP1 x64 100% 1366x768

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: How to make "sub excluded" copy?

Post 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
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to make "sub excluded" copy?

Post 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)...
One of my scripts helped you out? Please donate via Paypal

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: How to make "sub excluded" copy?

Post 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
2021-01-24_131043.png (20.15 KiB) Viewed 724 times
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?
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to make "sub excluded" copy?

Post 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
One of my scripts helped you out? Please donate via Paypal

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: How to make "sub excluded" copy?

Post 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?)
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to make "sub excluded" copy?

Post 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).
One of my scripts helped you out? Please donate via Paypal

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: How to make "sub excluded" copy?

Post by eil »

now i got everything tuned and working, thanks.)
should i add topic to script branch with working variant?
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to make "sub excluded" copy?

Post by highend »

It belongs to this thread, so do it here
One of my scripts helped you out? Please donate via Paypal

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: How to make "sub excluded" copy?

Post 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
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to make "sub excluded" copy?

Post 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...
One of my scripts helped you out? Please donate via Paypal

Post Reply