I use PHP to write a single .txt file line by line, my example: -
<?php
$myfile = fopen("/var/www/html/divumwx/serverdata/filepileTextData.txt", "w") or die("Unable to open file!");
$txt = "pm25 = $pm25\n";
fwrite($myfile, $txt);
$txt = "pm10 = $pm10\n";
fwrite($myfile, $txt);
$txt = "co = $co\n";
fwrite($myfile, $txt);
$txt = "no2 = $no2\n";
fwrite($myfile, $txt);
$txt = "so2 = $so2\n";
fwrite($myfile, $txt);
$txt = "o3 = $o3\n";
fwrite($myfile, $txt);
$txt = "nh3 = $nh3\n";
fwrite($myfile, $txt);
$txt = "aod = $aod\n";
fwrite($myfile, $txt);
$txt = "dust = $dust\n";
fwrite($myfile, $txt);
$txt = "alder = $alder\n";
fwrite($myfile, $txt);
$txt = "birch = $birch\n";
fwrite($myfile, $txt);
$txt = "olive = $birch\n";
fwrite($myfile, $txt);
$txt = "grass = $grass\n";
fwrite($myfile, $txt);
$txt = "mugwort = $mugwort\n";
fwrite($myfile, $txt);
$txt = "ragweed = $ragweed\n";
fwrite($myfile, $txt);
$txt = "cloudCover = $cloudcover\n";
fwrite($myfile, $txt);
$txt = "kWh = $kwh\n";
fwrite($myfile, $txt);
$txt = "gridProduction = $gridProduction\n";
fwrite($myfile, $txt);
$txt = "solarBattery = $solarBattery\n";
fwrite($myfile, $txt);
$txt = "gridExport = $gridExport\n";
fwrite($myfile, $txt);
$txt = "batteryCharge = $batteryCharge\n";
fwrite($myfile, $txt);
$txt = "solarGeneration = $solarGeneration";
fwrite($myfile, $txt);
fclose($myfile);
?>
This results in a text file with contents in the format required by FilePile: -
pm25 = 24
pm10 = 28.9
co = 288
no2 = 35.6
so2 = 3.8
o3 = 12
nh3 = 1.2
aod = 0.13
dust = 0
alder = 0
birch = 0
olive = 0
grass = 0
mugwort = 0
ragweed = 0
cloudCover = 100
kWh = 0
gridProduction = 2443
solarBattery = -1913
gridExport = 0
batteryCharge = 1913
solarGeneration = 0