Author Topic: Remove uploaded file  (Read 688 times)

Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Remove uploaded file
« on: January 08, 2018, 01:02:17 am »
By accident I uploaded a file in the Develop Apps section of the Vera Web interface, how do you delete/remove files from there that are no longer required?

thanks

Online akbooer

  • Master Member
  • *******
  • Posts: 5972
  • Karma: +258/-69
  • "Less is more"
Re: Remove uploaded file
« Reply #1 on: January 08, 2018, 03:19:26 am »
With care, you can use the Lua function os.remove() remembering to put the full correct file path

Code: [Select]
os.remove "/etc/cmh-ludl/your-file-name"

by running this in the Lua Test window.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline Sorin

  • Administrator
  • Hero Member
  • *****
  • Posts: 924
  • Karma: +77/-8
Re: Remove uploaded file
« Reply #2 on: January 08, 2018, 06:53:24 am »
Or, our Customer Care team can give you a hand with it  8) if you have any difficulties with it.

See my signature for contact details
Sorin M. ▾ Community Manager
Vera Control, Ltd. ▾ Smarter Home Control  ▾ support@getvera.com ▾www.getvera.com ▾ +1 (866) 966-2272

HOURS OF OPERATION for Customer Care Department - 24/7

Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Re: Remove uploaded file
« Reply #3 on: January 08, 2018, 08:09:45 pm »
Awesome, thanks for the prompt response! I was like this is a bit random its easy as to upload a file but not so easy to delete :)

thanks

Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Re: Remove uploaded file
« Reply #4 on: January 08, 2018, 09:17:58 pm »
With care, you can use the Lua function os.remove() remembering to put the full correct file path

Code: [Select]
os.remove "/etc/cmh-ludl/your-file-name"

by running this in the Lua Test window.

Tried this but the file didn't remove, can you confirm the files seen in the Luup files listing are in that path /etc/cmh-ludl/<yourfilenamehere> as default when uploaded?

thanks

Online akbooer

  • Master Member
  • *******
  • Posts: 5972
  • Karma: +258/-69
  • "Less is more"
Re: Remove uploaded file
« Reply #5 on: January 09, 2018, 12:14:15 pm »
I've tried this and it does work.  Are you sure that you have the right filename plus extension?  Uploading files to Vera via the UI causes them to be compressed and they may have a .lzo extension.

The basic os.remove call may be  extended to return status indicators:

Code: [Select]
local a,b = os.remove "/etc/cmh-ludl/foo.foo"
luup.log (a)
luup.log(b)

should result in

Code: [Select]
a = true
b = nil

for success, or

Code: [Select]
a = nil
b = "/etc/cmh-ludl/foo.foo: No such file or directory"

for failure.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Re: Remove uploaded file
« Reply #6 on: January 09, 2018, 11:52:33 pm »
I've tried this and it does work.  Are you sure that you have the right filename plus extension?  Uploading files to Vera via the UI causes them to be compressed and they may have a .lzo extension.

The basic os.remove call may be  extended to return status indicators:

Code: [Select]
local a,b = os.remove "/etc/cmh-ludl/foo.foo"
luup.log (a)
luup.log(b)

should result in

Code: [Select]
a = true
b = nil

for success, or

Code: [Select]
a = nil
b = "/etc/cmh-ludl/foo.foo: No such file or directory"

for failure.

Ok I definitely must be missing something here. As per screenshot below I am trying to delete the akb-json.lua file so unless there is some hidden secondary extension I believe the command line should be;

Code: [Select]
os.remove "/etc/cmh-ludl/akb-json.lua"
https://www.dropbox.com/s/ek4hhkuv0j7faty/DeleteFile.jpg?dl=0

I throw that into the Test Luup Code (Lua) text box and it says send code but when I return to the listing of Luup Files that file is still there, even after a reboot.

thoughts?

thanks

Online akbooer

  • Master Member
  • *******
  • Posts: 5972
  • Karma: +258/-69
  • "Less is more"
Re: Remove uploaded file
« Reply #7 on: January 10, 2018, 03:31:28 am »
Ah, since you mention the actual file, some versions of that module needed to be installed in /usr/lib/lua/

But you would have to have loaded it there explicitly.

Another alternative location to consider is /etc/cmh-lu/ but that it usually just used for Vera files.
« Last Edit: January 10, 2018, 03:34:04 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1325
  • Karma: +73/-30
Re: Remove uploaded file
« Reply #8 on: January 10, 2018, 04:53:28 am »
Hi,

Files you upload to the Vera are compressed by default this is probably why you are not finding it with using just .lua as extension. It may be saver to use WinSCP or something so you can really see the files in the folder rather then shooting of some script.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.

Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Re: Remove uploaded file
« Reply #9 on: January 10, 2018, 09:02:58 am »
Ah, since you mention the actual file, some versions of that module needed to be installed in /usr/lib/lua/

But you would have to have loaded it there explicitly.

Another alternative location to consider is /etc/cmh-lu/ but that it usually just used for Vera files.

Correct! from memory I was loading the file related to a plugin (I forget now but I had made a note to find out how to delete it and finally got around to doing it).

Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Re: Remove uploaded file
« Reply #10 on: January 10, 2018, 09:07:50 am »
Hi,

Files you upload to the Vera are compressed by default this is probably why you are not finding it with using just .lua as extension. It may be saver to use WinSCP or something so you can really see the files in the folder rather then shooting of some script.

Cheers Rene

ahh this makes sense! I will give it a shot with WinSCP. What is the usual extension Vera uses for compressed files?

Online akbooer

  • Master Member
  • *******
  • Posts: 5972
  • Karma: +258/-69
  • "Less is more"
Re: Remove uploaded file
« Reply #11 on: January 10, 2018, 10:35:47 am »
ahh this makes sense! I will give it a shot with WinSCP. What is the usual extension Vera uses for compressed files?

As I mentioned previously...

Are you sure that you have the right filename plus extension?  Uploading files to Vera via the UI causes them to be compressed and they may have a .lzo extension.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Re: Remove uploaded file
« Reply #12 on: January 10, 2018, 10:43:59 am »
thanks @akbooer :)


Offline rjayyyy

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +1/-0
Re: Remove uploaded file
« Reply #13 on: January 10, 2018, 11:46:44 pm »
Just as an update, logged in via SCP and went to the aforementioned path. File as mentioned was lzo extension, remove as required :)

thanks for everyones help, good learning curve for me on this one :)


Online akbooer

  • Master Member
  • *******
  • Posts: 5972
  • Karma: +258/-69
  • "Less is more"
Re: Remove uploaded file
« Reply #14 on: January 11, 2018, 04:05:56 am »
Glad you nailed it in the end!

Thanks for closing the story with successful feedback to the forum.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.