I have a backup routine in SQL that automatically generates backup of the databases in this folder: D:\Backup\Backup_SQL\Databases
I created a bat (forfiles) that compacts these backup files and transfers them to another folder. The script is running correctly. Now I want to change the destination folder of the compressed files however this folder contains space in its name: Box Files. This folder is from an application that plays its own content in the cloud. As the folder contains space in the name, it is giving error in the execution of the script. Is it possible to make the bat recognize this folder with space?
Obs. You can not change the name of this folder as it is the default Box application.
Script bat used:
REM Path to WinRAR executable in Program Files
set path="C:\Program Files (x86)\WinRAR\";%path%
set data=%DATE%
set CURRDATE=%DATE:/=-%
set dia=%data:~-0,4%
set horario=%time%
set CURRTIME=%time:/=-%
set hora=%horario:~-0,2%
rar a F:\Teste Teste\Databases_%CURRDATE%_%HORA%.rar D:\Backup\Backup_SQL\Databases
pause
@ECHO ON
-------
Resultado da execução do bat:
D:\Backup\Script de backup>REM Path to WinRAR executable in Program Files
D:\Backup\Script de backup>set path="C:\Program Files (x86)\WinRAR\";C:\Windows\
system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShe
ll\v1.0\;C:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\;C:\Program
Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server
0\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\VSShel
l\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server0\DTS\Binn\;C:\Prog
ram Files (x86)\Java\jdk1.6.0_26/bin;C:\Program Files (x86)\Common Files\MicroSt
rategy;C:\Program Files (x86)\MicroStrategy\Intelligence Server;C:\Program Files
(x86)\Common Files\MicroStrategy\JRE0_51\Win32\bin\client;
D:\Backup\Script de backup>set data=08/06/2015
D:\Backup\Script de backup>set CURRDATE=08-06-2015
D:\Backup\Script de backup>set dia=08/0
D:\Backup\Script de backup>set horario=10:34:00,10
D:\Backup\Script de backup>set CURRTIME=10:34:00,10
D:\Backup\Script de backup>set hora=10
D:\Backup\Script de backup>rar a F:\Teste Teste\Databases_08-06-2015_10.rar F:\B
KP_Teste\My_Box_Files\Databases
RAR 4.01 Copyright (c) 1993-2011 Alexander Roshal 28 May 2011
Shareware version Type RAR -? for help
Evaluation copy. Please register.
Cannot open Teste\Databases_08-06-2015_10.rar
O sistema não pode encontrar o caminho especificado.
Creating archive F:\Teste.rar
Adding F:\BKP_Teste\My_Box_Files\Databases\VETORHPROD\Texto.txt OK
Adding F:\BKP_Teste\My_Box_Files\Databases\VETORHPROD OK
Adding F:\BKP_Teste\My_Box_Files\Databases OK
Done
D:\Backup\Script de backup>pause
Pressione qualquer tecla para continuar. . .
Thank you in advance.
Daniel.