Kodi Community Forum

Full Version: How to delete smb files using os.remove()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I want my script to be able to delete a file stored on an smb network share. I am running the script on an android tv box.
For example if I try:
os.remove('SMB://Computer Name/Music Directory/musicFileName.mp3')
The file doesn't get deleted and I also get an error. But the same method works if the file is located in the internal storage of the device. It also fails if the file is located on external storage
Thanks
Hello knmoses,

You have posted in the Developers area, so I am going to move your thread to the forum dedicated to general help for Android.
Try using xbmcvfs.delete

http://mirrors.kodi.tv/docs/python-docs/...mcvfs.html

In fact your better of using that module for all your file handling stuff in Kodi

Not Android specific either so should be moved back to Developer forum Wink
(2017-05-13, 12:56)spoyser Wrote: [ -> ]Try using xbmcvfs.delete

http://mirrors.kodi.tv/docs/python-docs/...mcvfs.html

In fact your better of using that module for all your file handling stuff in Kodi

Not Android specific either so should be moved back to Developer forum Wink

Thanks so much. It worked like magic