Author Topic: file.move with overwrite boolean  (Read 2467 times)

0 Members and 1 Guest are viewing this topic.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
file.move with overwrite boolean
« on: March 14, 2017, 01:44:42 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: file.move with overwrite boolean
« Reply #1 on: March 14, 2017, 01:56:38 PM »
Why is using File.Delete first a problem?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: file.move with overwrite boolean
« Reply #2 on: March 14, 2017, 02:12:08 PM »
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.)

Code: [Select]
<?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

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: file.move with overwrite boolean
« Reply #3 on: March 14, 2017, 02:21:26 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  :)


Quote
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.)
Thanks I'll give it ago and see how it works

keep up the great work  8)