Hello,
I've made an app that lets you save the canvas into a mainfolder with a subfolder
mainfolder name is made by the app and the subfolder name is based on user input.
the pictures are saved within the subfolder
Is there a way to with the push of a button delete the subfolder and its contents?
I think you need to try with your App as an APK. Note also that you should put your main folder directly on the virtual SD drive and not in the App Inventor Companion path.
And install the .apk I dont get any sort of error message but I dont see any file/folder made on the SD card.
I was lookingfor "/sdcard/mainfolder/projectname/picturename.jpg"
There is currently a bug (copy a file from the assets) with the FileTools ext. from @vknow360 that will be fixed soon, then you can do it all with one (his) extention.
But maybe you don't need the method copy files from assets to external storage. Then you can of course do it only with FileTools ext. from @vknow360. I need Taifun's ext. only for my example app (to copy the files from assets to /storage/emulated/0/myFolder).
Hi @Anke
There is no need to get file list and delete files one by one.
Simply use file or folder name in FileTools.Delete method and it will do the rest.If path is a file then it will only delete that file but if it is a folder then it will delete all files first and then the folder.
Thank you,
It should be clear that I dont have a background in coding or anything so I might be missing out on something obvious here.
I've added this to the initialize
Thinking it will prompt and request premission which is does, so thats cool.
I've set the save location to
I'm uncertain about the placement of the dashes in this but it does work when I save canvas I get a row of folders in folder's storage-emulated-0-mainfolder and then the folder based on user imput : projectname.
the picture based on mmdd and puntnumber.jpg gets saved in there all fine and good so far.
I've tryed doing this:
but that doesnt work, gives a message that is does not exists.
Also copied from youre examle.
I changed the directory name and the extension to false thinking as its a folder I want to delete there is no extension.
But this again does not work.
it was mentioned before that it would benifit me to store the data on physical sd card but I dont have on in my phone so I would like to be able to do this on the internal storage
As previously indicated, you have to delete all the files inside a folder before you can delete the folder.
The TaifunFile extension returns a full path to each file, this needs to be modified to a relative path before it can be deleted. The example assumes no subdirectories. If you have subdirectories, then create a routine to delete each of these (and the files within them) before trying to delete the top level directory.
I think that was because of using empty string.At that time 'absoluteFilePath' (which creates absolute file path from relative file path) method was returning external storage's path for empty string but after his issue I fixed that and now it returns empty string for empty string.
So now there should not be any issue in using that method