04-24-2024, 11:13 AM
(This post was last modified: 04-24-2024, 11:15 AM by PhilOfPerth.)
(04-24-2024, 10:05 AM)a740g Wrote:(04-24-2024, 08:26 AM)PhilOfPerth Wrote: It works! Thank you.
Now, onward and upward!
Is there a function to create a "backup" of a file, (say myfilebak, from myfile)?
There are no commands to directly make copies or backup of files. But you could write one with a few lines of code like:
Code: (Select All)' Copies src to dst
' Set overwite to true if dst should be overwritten if present
SUB CopyFile (src AS STRING, dst AS STRING, overwrite AS _BYTE)
IF _FILEEXISTS(src) THEN
IF NOT _FILEEXISTS(dst) OR (_FILEEXISTS(dst) AND overwrite) THEN
_WRITEFILE dst, _READFILE$(src)
END IF
END IF
END SUB
Thanks again.
That code stretched my primitive mind to its fullest extent, but I eventually interpreted it to Phil-ese, to read:
If the original (src) exists, then
if there’s no backup (dst), or there is a backup but overwrite is set, then copy the src to dst
write the original to backup
Now, to try it!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Please visit my Website at: http://oldendayskids.blogspot.com/
Please visit my Website at: http://oldendayskids.blogspot.com/