[Solved] In what order do files get joined?
Posted: 05 Mar 2020 08:15
I have this script (I think I got it from someone on this forum):
I'm afraid to use this when the order of joining matters. Is there a GUARANTEED order? For instance, always alphabetically, or always in the order how it is displayed in the file list, or maybe depending on how you drag select the files (top to bottom, or bottom to top), or maybe in which order you <CTRL>-clicked them?
Does someone know 100% sure?
Code: Select all
//Combine selected files in order
"Concatenate Files"
$itemCount = get("CountSelected");
if ($itemCount < 2){
msg "Please select two or more files to concatenate.", 0 + 48;
}
else {
//No modifier keys pressed - use defaults
$outputFileExt = getpathcomponent("<selitem>", "ext");
//Initialise variables used in loop
$outputFilePath = <curpath> . "\" . <date yyyy-mm-dd-hh-mm-ss> . ".$outputFileExt";
$index = 0;
//Process files
foreach($token, <get selecteditemspathnames |>) {
$index = $index + 1;
$fileContent = readfile("$token");
writefile("$outputFilePath", $fileContent, "a");
}
status "Concatenated file generation complete - $outputFilePath";
}
Does someone know 100% sure?