Jump to content

"FileMove" and "FileCopy" create empty files


kt
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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

 

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...