HELP!!! MOVEFILE> wont overwrite

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Eric D
Junior Coder
Posts: 27
Joined: Thu Sep 19, 2002 6:08 pm
Location: Orange County, CA

HELP!!! MOVEFILE> wont overwrite

Post by Eric D » Thu May 01, 2003 7:14 pm

I am trying to do a movefile and perform an overwrite if the file exists at the destination but it will not do that. I was hoping there would be a sys var like CFOverwrite but cannot locate one.

I don't want to use the GetFilelist> then copy then delete, Is there anyway to accomplish an overwrite on MoveFile>

Thanks

Eric

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu May 01, 2003 9:24 pm

There is a Macro Scheduler variable that works with CopyFile. It may also work with MoveFile (I am not sure if I have ever tested the variable with MoveFile).

From the Macro Scheduler Help:
CF-OVERWRITE allows changing CopyFile to overwrite or rename on collision.

Add this line at the beginning of your macro to change the default for the entire macro:
LET>CF_OVERWRITE=1

Or add it before you do MoveFile and add
LET>CF_OVERWRITE=0
on the next line to set it back to default of 0.

Hope this helps......
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu May 01, 2003 9:36 pm

Or use IfFileExists first. Just as with moving files in Windows Explorer you can't move files to existing files and have to delete them first, you can't with the MoveFile command.

IfFileExists>file,DeleteIt
Goto>MoveIt
Label>DeleteIt
DeleteFile>file
Label>MoveIt
MoveFile>srcfile,target_location
MJT Net Support
[email protected]

Guest

Post by Guest » Thu May 01, 2003 10:11 pm

support wrote:Or use IfFileExists first. Just as with moving files in Windows Explorer you can't move files to existing files and have to delete them first, you can't with the MoveFile command.

IfFileExists>file,DeleteIt
Goto>MoveIt
Label>DeleteIt
DeleteFile>file
Label>MoveIt
MoveFile>srcfile,target_location
Thanks for the reply. I wont know the file name ahead of time so I am forced to use the getfilelist> and CopyFile>

The MoveFile is sooo fast. That is why I went that route. Any chance of getting a MF_OVERWRITE=1 sys var?

Eric

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu May 01, 2003 10:57 pm

Sorry, bu I am confused. You wrote:
I wont know the file name ahead of time so I am forced to
use the getfilelist> and CopyFile>
Please end my confusion: What name are you using with MoveFile? You must know the name at that time. Why can't you use the same name with IfFileExists?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts