I am converting a program I wrote with B4PPC to transfer files in large numbers from one card to another using the device (Asus TF101, Android 3.1) to run the process. The main use is to move photo files from a full camera CF card (in a USB adapter) to a 32 gig SD card, either for backup purposes or to free the CF card for further use. There can be well over 1,000 3MB+ files on a 4 gig CF card, so all sorts of questions arise and I don't know the answers yet - expect more from me in the future !
My current question is how do I tell if there is enough space on the receiving removable card for the files I want to transfer to it ? Even an external app like "File Manager HD", which analyses storage used, won't drill down beyond the main (non-removable) SDcard directory to the removable directory. As tablets with comprehensive external storage become more popular, surely this must become a necessary function?
My first thought is to add up the filesizes of all files on the receiving card and subtract that from the basic known size of the card. Then add up the filesizes of the files to be transferred, and see which is bigger. With 1000+ files to be transferred and potentially 10,000 on the receiving card this might take some time... (I take a lot of photos when I go away, indeed that is the whole point of going away at great expense so I make the most of it). I believe I can short-circuit the process somewhat.
Each of my cards has a tiny file "ID.txt" which contains an identifying name for the card, for example my single 32 gig MicroSD card is "MSD32-1", the 4 gig CF cards are "CF4-1", "CF4-2" and so on. If the MicroSD card gets full, there is a 32 gig SD Card ("SD32-1") to carry on the task. I could add a line of text in this file on the receiving cards which shows the space available as shown on my desktop PC before I go away, then check the ID file that there is enough space before each image file is added, and re-write it afterwards with a number representing the previous figure less the size of the new file - ie space remaining.
In any case, I suspect there may be an issue with files taking up more physical room than their actual size in bytes so more research will be needed.
This seems like an awful lot of trouble to go to for what should be a simple task, so have I missed something hidden away in a library or does anyone have any suggestions ? I'm a newbie with B4A so please don't make it complicated.
Thanks
Caravelle
My current question is how do I tell if there is enough space on the receiving removable card for the files I want to transfer to it ? Even an external app like "File Manager HD", which analyses storage used, won't drill down beyond the main (non-removable) SDcard directory to the removable directory. As tablets with comprehensive external storage become more popular, surely this must become a necessary function?
My first thought is to add up the filesizes of all files on the receiving card and subtract that from the basic known size of the card. Then add up the filesizes of the files to be transferred, and see which is bigger. With 1000+ files to be transferred and potentially 10,000 on the receiving card this might take some time... (I take a lot of photos when I go away, indeed that is the whole point of going away at great expense so I make the most of it). I believe I can short-circuit the process somewhat.
Each of my cards has a tiny file "ID.txt" which contains an identifying name for the card, for example my single 32 gig MicroSD card is "MSD32-1", the 4 gig CF cards are "CF4-1", "CF4-2" and so on. If the MicroSD card gets full, there is a 32 gig SD Card ("SD32-1") to carry on the task. I could add a line of text in this file on the receiving cards which shows the space available as shown on my desktop PC before I go away, then check the ID file that there is enough space before each image file is added, and re-write it afterwards with a number representing the previous figure less the size of the new file - ie space remaining.
In any case, I suspect there may be an issue with files taking up more physical room than their actual size in bytes so more research will be needed.
This seems like an awful lot of trouble to go to for what should be a simple task, so have I missed something hidden away in a library or does anyone have any suggestions ? I'm a newbie with B4A so please don't make it complicated.
Thanks
Caravelle