How would I delete all the files in a directory? - LUA Scripting - CHDK Forum

How would I delete all the files in a directory?

  • 2 Replies
  • 8133 Views
How would I delete all the files in a directory?
« on: 22 / June / 2012, 23:34:20 »
Advertisements
Sorry, I'm really new to this.  I took a look at: http://chdk.setepontos.com/index.php?topic=2267.0 but I can't seem to make much sense of it.  I verified my camera with the test, put some of the scripts on my SD card, and tried this code...

Code: [Select]
os.remove("A/DCIM/100CANON/IMG_3652.JPG")

It made it so the file explorer couldn't locate the file, but in play mode there was still an unreadable thing that I deleted with the trash button.  So how would I successfully mass delete images via Lua?

I also attached the two scripts that I put on my SD card.  The core script (i think) is .lua, while the patch script is .diff

*

Offline reyalp

  • ******
  • 14118
Re: How would I delete all the files in a directory?
« Reply #1 on: 23 / June / 2012, 00:06:30 »
os.remove removes the file. Some parts of the Canon firmware may not notice that it has been removed until you restart the camera.

If you have another file with the same number (for example a raw, or a voice note) the camera may still show something like a missing image icon even though the jpeg is gone.

The post you got those files from was posted in 2008. That functionality has been included in CHDK for a long time. The diff file is a patch for the source code, which won't do anything on your SD card. The test script functionality is now in llibtst.lua, which is included in the standard CHDK distribution.
Don't forget what the H stands for.

Re: How would I delete all the files in a directory?
« Reply #2 on: 23 / June / 2012, 01:38:19 »
Ok, thank you!

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal