You are here

Backup Rotation script returns error

4 posts / 0 new
Last post
77FordF100
77FordF100's picture
Offline
Last seen: 2 years 9 months ago
Joined: 2011-08-12 20:59
Backup Rotation script returns error

When I used version 2 the following script was in the help file and worked just fine for my needs.

Delete "E:\Backup-5.zip"
Rename "E:\Backup-4.zip" "E:\Backup-5.zip"
Rename "E:\Backup-3.zip" "E:\Backup-4.zip"
Rename "E:\Backup-2.zip" "E:\Backup-3.zip"
Rename "E:\Backup-1.zip" "E:\Backup-2.zip"
Backup "RotationBackupJob"

Now that I'm using version 3, the script fails after the first line with the following error.

Cannot run lua file: [string "Delete "E:\Backup-5.zip"..."]:2: '' expected near '\'

I've looked through the help file and tried some other things but cannot get it to work. Any help would be much appreciated.

Steve Lamerton
Steve Lamerton's picture
Offline
Last seen: 11 years 1 month ago
Developer
Joined: 2005-12-10 15:22
Hi,

the problem you have is with your strings, you either need to put double backslashes in your paths, or use angle brackets rather than quotes. For example

Delete "E:\\Backup-5.zip"
Rename "E:\\Backup-4.zip" "E:\\Backup-5.zip"
Rename "E:\\Backup-3.zip" "E:\\Backup-4.zip"
Rename "E:\\Backup-2.zip" "E:\\Backup-3.zip"
Rename "E:\\Backup-1.zip" "E:\\Backup-2.zip"
Backup "RotationBackupJob"
77FordF100
77FordF100's picture
Offline
Last seen: 2 years 9 months ago
Joined: 2011-08-12 20:59
Thanks. I gave that a try

Thanks. I gave that a try and get the following error.

Cannot run lua file: [string "Delete "E:\\Backup-5.zip"..."]:1: attempt to call global 'Delete' (a nil value)

Toucan version is 3.0.4

Steve Lamerton
Steve Lamerton's picture
Offline
Last seen: 11 years 1 month ago
Developer
Joined: 2005-12-10 15:22
Sorry,

I thought based on that syntax you were using an older 2.x release, you probably need this:

delete("E:\\Backup-5.zip")
rename("E:\\Backup-4.zip", "E:\\Backup-5.zip")
rename("E:\\Backup-3.zip", "E:\\Backup-4.zip")
rename("E:\\Backup-2.zip", "E:\\Backup-3.zip")
rename("E:\\Backup-1.zip", "E:\\Backup-2.zip")
backup("RotationBackupJob")
Log in or register to post comments