Backup on SD Card on Android

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Backup on SD Card on Android

Post by Yass »

Dear Cspro Team,

Please I have this folder structure
GNCR (Main folder) that contains subfolders : (1) Application - Contains Application (2)Menu Folder - Contains the Menu and (3) Data folder which Contains Sub folders which are MainData and ListingData. I then wrote the follow codes in my pff file to run backup anytime the pff file is written but i get path error.

The copy is done on the internal memory of the tablets with <invalid path> error. Kindly assist me as always.

Code: Select all

function gncr()

    string pffFilename1 = pathname(Application) + "../Application/gncr.pff";
	setfile(pffFile1,pffFilename1,create);
	...............................................................
	
    string GCABackup = pathname(CSEntryExternal) + maketext("Backup%d",timestamp());
    dircreate(GNCRBackup);
    if SU = 1 then
    
    if filecopy(pathname(Application) + "../Data/MainData/GNCRDATA.csdb",GCABackup) = default then 
        errmsg("Insert an SD card"); 
        
    elseif filecopy(pathname(Application) + "../Data/ListingData/LIST.csdb",GCABackup) = default then 
        errmsg("Insert an SD card");
   endif;
	
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Backup on SD Card on Android

Post by josh »

The code looks ok so the error is probably in one of the paths. Double check that "Data/MainData/GNCRDATA.csdb" and "Data/ListingData/LIST.csdb" are correct.

I would use errmsg to print out the value of pathname(CSEntryExternal) to make sure the external SD directory is valid.

Also check the return value of dircreate to make sure it worked correctly.
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Re: Backup on SD Card on Android

Post by Yass »

Hi Josh,

I have tried severally , am unable to figure out the issue to write the backup, can kindly send you the application for a look. Thanks.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Backup on SD Card on Android

Post by josh »

Sure go ahead and send the application
Post Reply