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

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

Re: How to make "sub excluded" copy?

Post by eil »

again a question of interest in progress

Code: Select all

$ec_get = quicksearch("* /f /maxdepth=0", <selitems |>,"|");
when few files and folders are selected it's fine and it "finds" only files on zero level, but if only folders being selected, "files on zero level" fails and takes selected folders as not list to search among but as pathes for search, starting a search inside this folders. is there a way to "fix" this with switches or smt, so that if no files found amount list of selected items, forbid search to go "deeper".?
Win 7 SP1 x64 100% 1366x768|1900x1080

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

Re: How to make "sub excluded" copy?

Post by highend »

Em, what?

If you don't want to execute the search inside only selected folders, check if your selected items don't contain any files?

Code: Select all

    end (<get countselected> == 0), "No item(s) selected, aborted!";
    $selectedItems   = <get SelectedItemsPathNamesSlashed |>;
    $selectedFiles   = formatlist($selectedItems, "f", , "!*\");
    $selectedFolders = formatlist($selectedItems, "f", , "*\");

    if (!$selectedFiles) { // do this... }
    // ...
One of my scripts helped you out? Please donate via Paypal

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

Re: How to make "sub excluded" copy?

Post by eil »

highend wrote: ↑25 Jan 2021 00:28

Code: Select all

    end (<get countselected> == 0), "No item(s) selected, aborted!";
    $selectedItems   = <get SelectedItemsPathNamesSlashed |>;
    $selectedFiles   = formatlist($selectedItems, "f", , "!*\");
    $selectedFolders = formatlist($selectedItems, "f", , "*\");

    if (!$selectedFiles) { // do this... }
    // ...
very useful code! as a noob never used this slashed command or definition logic. finally after 5(!) full revisions i think i finished it.

Code: Select all

  end (<get countselected> == 0), "No item(s) selected, aborted!";
  $selItems   = <get SelectedItemsPathNamesSlashed |>;
  $selFiles   = formatlist($selItems, "f", , "!*\");
  $selFolders = formatlist($selItems, "f", , "*\");

  $what = confirm("Exclude:    Cansel = Quit|Yes = Folders    No = Items|", |, 3, 3);
    if ($what == "1") {
	$excl_Get = $selFolders . "|" . quicksearch("* /d", $selFolders,"|");
        $excl_Get = formatlist($excl_Get, "s");
        $excl_GetReplace = "+" . replace($excl_Get, "|", "|+");    
        $excl_GetFolders = inputselect( , $excl_GetReplace, "|", 1 + 2 + 32 + 64);
        $excl_GetReplace = replace($excl_GetFolders, "|", ";");    
        $excl_GetList =   $selFiles . "|" . quicksearch("* /f /maxdepth=0", $excl_GetReplace,"|");
        $excl_GetList = formatlist($excl_GetList, "s");
        //copy $excl_GetList, 'copy';  #216;
        status "Excluded Copy:: list is Ready",, 'ready';
	copyto inputfolder( , "Select Folder"), $excl_GetList, <curpath>, 2, 1, -1, 1, , , , , 1; 
    }
    elseif ($what == "0") {
	$excl_Get = quicksearch("* /f", $selItems,"|");
        //copy $excl_Get, 'copy';  	#216;
        status "Excluded Copy:: list is Ready",, 'ready';
	copyto inputfolder( , "Select Folder"), $excl_GetList, <curpath>, 2, 1, -1, 1, , , , , 1; 
    }
    else {
	break 1;    
    }
Win 7 SP1 x64 100% 1366x768|1900x1080

Post Reply