GIGA, copyfiles() behave a bit not normal

Hi,
I am trying to use copyfiles() function to copy one file, it works but also display file content - why? or how to turn it off.
my code:

void copyOneFileFs()
{
        String fn=SearchFileName();
        Serial.println(fn);
               
        int err = fs.mount(&fs_data);
        String fname1="/fs/";
        fname1.concat(fn);
        fname1.concat(".col");
        String fname2="/usb/";
        fname2.concat(fn);
        fname2.concat(".col");
        
        Serial.println(doesFileExistFs(fn+".col"));
        Serial.println(doesFileExistFs(fn+".get"));

        Serial.print("copy: ");
        Serial.print(fname1);
        Serial.print(" to: ");
        Serial.println(fname2);
        copyfiles(fname1,fname2);
        Serial.print("done.");
}

where SearchFileName() is an file name input function and doesFileExistFs() check if file exist.
the output form it looks like that:

123
Done
-----exist------123.col
1
Done
OK
0
copy: /fs/123.col to: /usb/123.col
copy from: /fs/123.col to: /usb/123.col
reregfddg
done.

123 is entered file name,
but "reregfddg" is content of the file, but I did not ask to display it in the code, does copyfiles() has it by default? how to turn it off?
Regards

Hi,
Is copyfiles() from a library you have included?

Hi,
this is what I use:

#include "Arduino_GigaDisplay_GFX.h"
#include "Arduino_GigaDisplayTouch.h"
#include <Wire.h>
#include <INA3221.h>
#include "mbed.h"
#include <mbed_mktime.h>
#include <WiFi.h>
#include <WiFiUdp.h>
#include <Arduino_USBHostMbed5.h>
#include <DigitalOut.h>
#include <FATFileSystem.h>
#include <Arduino_AdvancedAnalog.h>
#include <Arduino_GigaDisplay.h>
#include "MBRBlockDevice.h" 
#include <PluggableUSBMSD.h> 
#include "QSPIFBlockDevice.h"

I created a sketch with those libraries and a call to copyfiles(); in the setup. Compiler couldn't find copyfiles! How did you find copyfiles? Was it in an example somewhere?

Look at the API description for copyfile (or mouse hover?) to see if there is a 'quiet' setting.

What library gives you SearchFileName, and copyfiles?

Hi,
seems my mistake,
I got some part of this code from other friend working on this project and seems copyfiles() is his definition, I bet that it was from FATfileSystem.
SearchFileName() is my function, basically this is demo code: List File Directory which return value if file exist or not.
I am sorry for my mistake.
Regards

1 Like