News:

VoxCommando works with Amazon Echo, Domoticz, EventGhost, Google Assistant, IFTTT, iTunes, J.River Media Center, Kodi, MediaMonkey, Nest, Philips Hue, Vera, Wemo, and the list keeps growing!

Main Menu

file.move with overwrite boolean

Started by PegLegTV, March 14, 2017, 01:44:42 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

PegLegTV

would it be possible to add a Boolean to File.Move for overwrite option, I'm working on a few commands that would be simpler if it could just overwrite the file, as of now I'm having to use either file.Delete or File.GetFiles and File.Delete.

Thanks  :)

jitterjames

Why is using File.Delete first a problem?

nime5ter

Have you tried Launch.CMD? I think the following is working in the way you describe -- moving a file and overwriting a file of the same name if it exists at the destination path. (I haven't rigorously tested this -- just once with a text file.)

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.3.5-->
<command id="69" name="move and overwrite file" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.CMD</cmdType>
    <params>
      <param>MOVE /Y "yourfile_sourcepath" "yourfile_destinationpath"</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>move and overwrite file</phrase>
</command>
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

Quote from: jitterjames on March 14, 2017, 01:56:38 PM
Why is using File.Delete first a problem?
it's not really a problem, I was thinking that having the Boolean for overwrite could make the command simpler (less actions), I was thinking with my lazy brain  :)


QuoteHave you tried Launch.CMD? I think the following is working in the way you describe -- moving a file and overwriting a file of the same name if it exists at the destination path. (I haven't rigorously tested this -- just once with a text file.)
Thanks I'll give it ago and see how it works

keep up the great work  8)