SD card file rename?
Anybody figured out how to rename a FAT16 file using fsrw or Femtofsrw?
It would be very convenient to have this ability right now for me...
It would be very convenient to have this ability right now for me...

Comments
First you have to make sure there isn't a file already with the new name, then you have to
open the file under the old name, change the directory entry, and write it back. It's not too
different from deleting a file, but somebody has to do the work.
First copy the file to the new filename, then delete the old file.
IIRC, there is an example of copy & delete in Femto.
OBC
EDIT: yup thought I saw it in there... These could be adapted readily..
Copy
' COPY [noparse][[/noparse]<expr>],"<file>" or COPY "<file>",[noparse][[/noparse]<expr>] or ' COPY [noparse][[/noparse]<expr>],[noparse][[/noparse]<expr>] where <expr> are different if spaces == quote scanFileName(@f0) if spaces <> "," abort @syn skipspaces b := getAddress(",") & !$7FFF ifnot fsrw.checkPresence(b) abort string("No EEPROM there") if \fsrw.mount(spiDO,spiClk,spiDI,spiCS) < 0 abort string("Can't mount SD card") if \fsrw.popen(@f0,"r") abort string("Can't open file") if fsrw.pread(@f0,32) <> 32 abort string("Can't read program") if \fsrw.pclose < 0 abort string("Error closing file") \fsrw.unmount else a := getAddress(",") & !$7FFF ifnot fsrw.checkPresence(a) abort string("No EEPROM there") if spaces <> "," abort @syn skipspaces if spaces == quote scanFileName(@f0) if \fsrw.mount(spiDO,spiClk,spiDI,spiCS) < 0 abort string("Can't mount SD card") if \fsrw.popen(@f0,"w") abort string("Can't create file") b := 0 if \fsrw.pclose < 0 abort string("Error closing file") \fsrw.unmountDelete
' DELETE " <file> " if spaces <> quote abort @syn scanFilename(@f0) if \fsrw.mount(spiDO,spiClk,spiDI,spiCS) < 0 abort string("Can't mount SD card") if \fsrw.popen(@f0,"d") abort string("Can't delete file") if \fsrw.pclose < 0 abort string("Error deleting file") \fsrw.unmount▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just getting started with Propeller?
Propeller Cookbook
PropDOS
Post Edited (Oldbitcollector) : 12/1/2007 5:39:21 PM GMT
Mike: Is this what you are saying?
That's essentially what I'm saying. It's just that you have to do it properly with the right error checking.