Post Reply 
50G: SD card commands
05-08-2015, 12:44 PM
Post: #1
50G: SD card commands
Does the 50G have commands for working with files on the SD card? I mainly need to be able to check if a file exists, and also copy and/or rename a file without copying the entire file contents to main memory (which might not have enough space free to hold the entire file). This is mostly for manipulating backup files.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-08-2015, 01:47 PM
Post: #2
RE: 50G: SD card commands
(05-08-2015 12:44 PM)Dave Britten Wrote:  Does the 50G have commands for working with files on the SD card? I mainly need to be able to check if a file exists, and also copy and/or rename a file without copying the entire file contents to main memory (which might not have enough space free to hold the entire file). This is mostly for manipulating backup files.

Use VTYPE to test if a file exists in the SD card. Example:
':3:FOO' VTYPE
returns the file type if it exists, or -1 if it does not exist.

The RENAME function does not work on SD card files. However, there are libraries that include rename functions for SD card files. One such library is SDFiler by Tim Wessman and Claudio Daniel Lapilli.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
05-08-2015, 02:00 PM
Post: #3
RE: 50G: SD card commands
(05-08-2015 01:47 PM)Joe Horn Wrote:  
(05-08-2015 12:44 PM)Dave Britten Wrote:  Does the 50G have commands for working with files on the SD card? I mainly need to be able to check if a file exists, and also copy and/or rename a file without copying the entire file contents to main memory (which might not have enough space free to hold the entire file). This is mostly for manipulating backup files.

Use VTYPE to test if a file exists in the SD card. Example:
':3:FOO' VTYPE
returns the file type if it exists, or -1 if it does not exist.

The RENAME function does not work on SD card files. However, there are libraries that include rename functions for SD card files. One such library is SDFiler by Tim Wessman and Claudio Daniel Lapilli.

Yeah, I was using VTYPE in my script (:3:BACKUP.50G IF DUP VTYPE 17. == ...), then I started getting an insufficient memory error. As far as I can tell, it's recalling the object to main memory to evaluate the type, so if your backup is larger than the amount of free memory, you're out of luck.

This also presents a problem for copying the backup to a different file by recalling it to the stack. I may have to try an entirely different approach if I want rotating backups.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-08-2015, 04:03 PM
Post: #4
RE: 50G: SD card commands
(05-08-2015 02:00 PM)Dave Britten Wrote:  Yeah, I was using VTYPE in my script (:3:BACKUP.50G IF DUP VTYPE 17. == ...), then I started getting an insufficient memory error. As far as I can tell, it's recalling the object to main memory to evaluate the type, so if your backup is larger than the amount of free memory, you're out of luck.

This also presents a problem for copying the backup to a different file by recalling it to the stack. I may have to try an entirely different approach if I want rotating backups.

The library I mentioned above adds programmable commands to the 50g which can copy files to a new name, rename files, or copy/move files from one SD directory to another directly, all without using main memory. And you can use its XRCL command to check whether a file exists or not, since it returns a FALSE if the file does not exist.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
05-08-2015, 05:35 PM
Post: #5
RE: 50G: SD card commands
(05-08-2015 04:03 PM)Joe Horn Wrote:  The library I mentioned above adds programmable commands to the 50g which can copy files to a new name, rename files, or copy/move files from one SD directory to another directly, all without using main memory. And you can use its XRCL command to check whether a file exists or not, since it returns a FALSE if the file does not exist.

I'll have to give that a look, then. Sounds like it would be useful to have for a number of different things. Thanks.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)