"FileMove" and "FileCopy" create empty files

4 posts in this topic

Hi! I'm trying to rename "Excel Filter (JIRA).xls" to "JiraTickets.xls". 

When I use FileMove or FileCopy, it creates two files:

  • Excel Filter (JIRA).xls, size 1627 KB.
  • JiraTickets.xls, size 0 KB.

Here's my code (I comment out one at a time):

;Rename "Excel Filter (JIRA).xls" to "JiraTickets.xls"
;Try #1
FileCopy ( "K:\systems\Generic Systems\SSI&Tools\Simulation\KPIs\KPIs_Current\Excel Filter (JIRA).xls", "K:\systems\Generic Systems\SSI&Tools\Simulation\KPIs\KPIs_Current\JiraTickets.xls", $FC_OVERWRITE)

;Rename "Excel Filter (JIRA).xls" to "JiraTickets.xls"
;Try #2
FileMove ( "K:\systems\Generic Systems\SSI&Tools\Simulation\KPIs\KPIs_Current\Excel Filter (JIRA).xls", "K:\systems\Generic Systems\SSI&Tools\Simulation\KPIs\KPIs_Current\JiraTickets.xls", $FC_OVERWRITE)

It gets saved into the right folder, but "JiraTickets.xls" is always blank. I delete it before trying to start the script again.

See anything I'm doing wrong?

Share this post

Link to post
Share on other sites

Well that is a 1.6mb file, maybe the machine is old and it's still processing the copy/move? Throw the FileMove/FileCopy into the third argument for the MsgBox and it will pop up when it's finished and whether it finished successfully.

The file is being created so it's doing something.

1 person likes this

Share this post

Link to post
Share on other sites

Yeah, that's true. Didn't think about that! I'll give it a try, thanks :)

Share this post

Link to post
Share on other sites

#4 ·  Posted (edited)

Your syntax looks correct. Did you remember to 

#include <FileConstants.au3>

If you don't want to include a bunch of unnecessary variables:

Global Const $FC_NOOVERWRITE = 0 ; Do not overwrite existing files (default)
Global Const $FC_OVERWRITE = 1 ; Overwrite existing files
Global Const $FC_CREATEPATH = 8 ; Create destination directory structure if it doesn't exist

Add values to combine effects. 9 will overwrite existing files and create directory stuctures. You can also use 1+8 to keep things simple.

Edited by BetaLeaf
1 person likes this

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now