Joining two (or more) files

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Irwin of Upton
Posts: 131
Joined: 28 Feb 2015 19:42

Joining two (or more) files

Post 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:

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

Re: Joining two (or more) files

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

Irwin of Upton
Posts: 131
Joined: 28 Feb 2015 19:42

Re: Joining two (or more) files

Post 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:

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

Re: Joining two (or more) files

Post by highend »

Took 2 minutes, wouldn't call it complicated :mrgreen:
One of my scripts helped you out? Please donate via Paypal

Post Reply