MobiControl Package Studio Script uninstall

Solved
KS
Kevin Samplatzki
Voß Edelstahlhandel GmbH & Co. KG

Hi everyone, 

I would like to delete a file on an Android device using the MobiControl Package Studio. The files were also copied to the device via a package. There is the possibility to add scripts in the Package Studio. Does anyone have any idea how I can use this to delete the files? 

Soti Mobicontrol 2024.01

a year ago
SOTI MobiControl
ANSWERS
MD
Matt Dermody Diamond Contributor
a year ago

Yes you can use the del script and pass in the path to the file to delete them. The del script also supports wildcards so if you wanted to delete multiple files with the same file extension in a folder you could do that as well. Example:

del /sdcard/YourApp/*.json

This would delete any file with the *.json extension in the /sdcard/YourApp/ folder.

Note that this would potentially depend on what OS version you have and where the configuration files were originally placed. For example, if you have A11+ devices and the files you're trying to delete are in an app's scoped storage directory (/sdcard/android/data/...) then you won't be able to delete them with this process.

KS

Hi Matt, thanks for your description. 
I'll test it today and give you some feedback. 

KS

Hi Matt, unfortunately it doesn't work as you described. Maybe I'm making a mistake here too. I would like to delete all .jason files as shown in the screenshot and then copy the new jason into the directory. What other mistake am I making here?

Not sure if this issue is only on my end but i don't see the screenshot but a broken image icon :| 

KS

Now you should be able to see it. 

Your path contains spaces, so try to put it in " 

KS

Tested it now with " but the files are still there. 

i tested following:
1. copied a file to a new folder via: copy \sdcard\Download\test.docx "\sdcard\Download\test test\test.docx"
2. deleted it via: del "\sdcard\Download\test test\*.docx"

Both with success.
So:
1. please check if your path is correct
2. test your script in the console and verify it's working
3. put the script into the package and check again.

Just a tipp: For such things i use the task schedule profile instead of packages now, works best in my opinion for such simple tasks and you can just save the used script in the console (manage scripts) and use it in the task profile then.

Solution
MD
Matt Dermody Diamond Contributor
a year ago

First, are you sure the extension is actually *.jason and not *.json? 

Second, Pre-Uninstall means the script is not process until the Package you're applying is unassigned. If you want the files deleted immediately when the Package is assigned then it should be a Pre-install script.

KS

Hi Rafael, the script can be executed directly on the console and works. 

I will try it again as Matt recommended here. 
Thank you for your support, that is already a sufficient solution for me. I will continue testing here. 

P
PMMOD@SOTI
a year ago

Hi Kevin Samplatzki,

Thank you for your post on SOTI Pulse, do you still require any assistance with the above issue?

Hopefully, you were able to solve the post by using the above-suggested solutions.  If yes, please mark it as "solution".

Please let us know so we can proceed further accordingly.