Page 1 of 1

Joining two (or more) files

Posted: 25 Nov 2017 15:50
by Irwin of Upton
Using XYplorer is there a simple way to join (concatenate) several ASCII files? Intuition is that it can be accomplished with Paste but can not get it to work right. Maybe need a script? :veryconfused:

Re: Joining two (or more) files

Posted: 25 Nov 2017 16:05
by highend

Code: Select all

    $content = "";
    foreach($item, get("SelectedItemsPathNames", <crlf>), <crlf>, "e") {
        if (strpos(get("genericfiletype", "{:Text}"), "." . gpc($item, "ext")) != -1 && exists($item) == 1) {
            $content = $content . (($content) ? <crlf 3> . readfile($item) : readfile($item));
        }
    }
    if ($content) { writefile("<curpath>\joined_files.txt", $content); }

Re: Joining two (or more) files

Posted: 25 Nov 2017 16:47
by Irwin of Upton
To Highend - Thank you for assembling the code to concatenate files. Not only was it not simple but it didn't even use Paste function. Shows what little I know. :oops:

Re: Joining two (or more) files

Posted: 25 Nov 2017 16:50
by highend
Took 2 minutes, wouldn't call it complicated :mrgreen: