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
HELP!!! MOVEFILE> wont overwrite
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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......
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!
Bob
A humble man and PROUD of it!
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
IfFileExists>file,DeleteIt
Goto>MoveIt
Label>DeleteIt
DeleteFile>file
Label>MoveIt
MoveFile>srcfile,target_location
MJT Net Support
[email protected]
[email protected]
Thanks for the reply. I wont know the file name ahead of time so I am forced to use the getfilelist> and CopyFile>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
The MoveFile is sooo fast. That is why I went that route. Any chance of getting a MF_OVERWRITE=1 sys var?
Eric
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Sorry, bu I am confused. You wrote:
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?I wont know the file name ahead of time so I am forced to
use the getfilelist> and CopyFile>
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!