Search the Community
Showing results for tags 'MoveDir'.
-
Hi All, I've got a head scratcher that I am hoping someone could help me with as I'm trying to finsih up some code for our HR department that I need to put into production by Monday morning. I have written a Autoit script that shuts down a database engine and then does a copy of the database to a folder on the database server. Unfortunately the backup space on the server is limited so I have been manually moving the backups to another server twice a week until I could find the time to automate the move of the files and folders as part of the script. Well the time to automate it is this weekend per my CIO. Because the end users may do multiple backups in a given day, I have assigned the month-day-year_hours-minutes-seconds to a variable and I rename the initial backup folder and logfile by appending the datetime variable to them. So the folder Daily_ becomes Daily_06302012_192515 and Daily_.log becomes Daily_06302012_192515.log. Using the FileMove function I have been able to get it to move the log file but for the life of me I can't get it to move the folder . So I tried to use DirMove, but I can't get it to work either. The process runs, but the folder in still on the original server when it finishes. The code I am using to try and accomplish this is as follows: $datetime = @MON & @MDAY & @YEAR & "_" & @hour & @min & @SEC RunWait('PsExec \\RHP-VMS-001 robocopy "\\RHP-VMS-001\ANSOSONESTAFF\DATA" "\\Rhp-vms-001 Staff_backups\OS_Daily\daily_" /COPYALL /S /E /V /LOG+:" RunWait(@comspec & " /c ren \\rhp-vms-001\staff_backups\OS_Daily\daily_ Daily_" & $datetime) RunWait(@comspec & " /c ren \\Rhp-vms-001\staff_backups\OS_Daily\Daily_.log Daily_" & $datetime & ".log") RunWait('sc \\RHP-VMS-001 start "Pervasive.SQL (relational)"', '', @SW_HIDE, 2) RunWait('sc \\RHP-VMS-001 start "Pervasive.SQL (transactional)"', '', @SW_HIDE, 2) FileMove("\\rhp-vms-001\staff_backups\OS_Daily\*.*", "\\rhp-diskbackup\onestaff\OSTest_Daily") DirMove("\\rhp-vms-001\staff_backups\OS_Daily\Daily_" & $datetime, "\\rhp-diskbackup\onestaff\OSTest_Daily") Else MsgBox(0,"One Staff Backup", "Database engine is down please contact the IS Department") Exit etc etc Any help is greatly appreciated as I can;t seem to fignure out what I'm doing wrong. Thanks Gordon