Skumar_CCSA
asked on
Copy the file through script and file generation
Hi ...
OS Win 2008 R2 64bit.
I experienced some issues while settings up backup for PostgreSQL...found compatible issue. Finally decided to run script for copy the backup file with file generation.
I am good at script, request your help...
Backup.bak file store in local drive, location d:\data\back\backup.audit
I want to run the script which will copy the file everyday or weekly from the above location to D:\generation
I am looking for script which will copy the file in sequence with date and time it copy..also possible of having log file to know the file name change from source file to new file name with ddmmyyyyhhmmss.
Can you please help me....
OS Win 2008 R2 64bit.
I experienced some issues while settings up backup for PostgreSQL...found compatible issue. Finally decided to run script for copy the backup file with file generation.
I am good at script, request your help...
Backup.bak file store in local drive, location d:\data\back\backup.audit
I want to run the script which will copy the file everyday or weekly from the above location to D:\generation
I am looking for script which will copy the file in sequence with date and time it copy..also possible of having log file to know the file name change from source file to new file name with ddmmyyyyhhmmss.
Can you please help me....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Small correction it should be set datetime= instead of set datetimef= in second line
ASKER
getting an error
-------------------------- -
Windows Script Host
-------------------------- -
Script: F:\bac\move.vbs
Line: 1
Char: 1
Error: Invalid character
Code: 800A0408
Source: Microsoft VBScript compilation error
-------------------------- -
OK
-------------------------- -
@echo off
set datetime=%date:~-4%_%date: ~-7,2%_%da te:~-10,2% _%time:~0, 2%_%time:~ 3,2%_%time :~6,2%
echo %datetime%
cp f:\data\back\backup.audit f:\generation\backup_%date time%.audi t
--------------------------
Windows Script Host
--------------------------
Script: F:\bac\move.vbs
Line: 1
Char: 1
Error: Invalid character
Code: 800A0408
Source: Microsoft VBScript compilation error
--------------------------
OK
--------------------------
@echo off
set datetime=%date:~-4%_%date:
echo %datetime%
cp f:\data\back\backup.audit f:\generation\backup_%date
what i had given is batch script save it as mov.bat
ASKER
I tried both .... .bat and .vbs
It didn't work
It didn't work
how are you running the script?
ASKER
i get below error now..
2014_03_03_17_26_54
'cp' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
2014_03_03_17_26_54
'cp' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
ASKER
@echo off
set datetime=%date:~-4%_%date: ~-7,2%_%da te:~-10,2% _%time:~0, 2%_%time:~ 3,2%_%time :~6,2%
echo %datetime%
copy "D:\Backup\from DB\backup.bak" "D:\Backup\to CommVault\backup_%datetime %.bak"
it worked finally....
change is required.
copy instead cp.
set datetime=%date:~-4%_%date:
echo %datetime%
copy "D:\Backup\from DB\backup.bak" "D:\Backup\to CommVault\backup_%datetime
it worked finally....
change is required.
copy instead cp.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 300 points for vikas_madhusudana's comment #a39894151
Assisted answer: 100 points for vikas_madhusudana's comment #a39894478
Assisted answer: 0 points for Skumar_CCSA's comment #a39900053
for the following reason:
All three of worked for solution.
points shared...
Accepted answer: 300 points for vikas_madhusudana's comment #a39894151
Assisted answer: 100 points for vikas_madhusudana's comment #a39894478
Assisted answer: 0 points for Skumar_CCSA's comment #a39900053
for the following reason:
All three of worked for solution.
points shared...
ASKER
this issue is resolved....
i gave points also...
want to close it...so that it will not list in my open question.
i gave points also...
want to close it...so that it will not list in my open question.
ASKER
wrongly clicked close button while using iphone
ASKER
wrongly clicked close button while using iphone
ASKER
I've requested that this question be closed as follows:
Accepted answer: 450 points for vikas_madhusudana's comment #a39894151
Assisted answer: 25 points for vikas_madhusudana's comment #a39894478
Assisted answer: 0 points for Skumar_CCSA's comment #a39900053
for the following reason:
correct code.
Accepted answer: 450 points for vikas_madhusudana's comment #a39894151
Assisted answer: 25 points for vikas_madhusudana's comment #a39894478
Assisted answer: 0 points for Skumar_CCSA's comment #a39900053
for the following reason:
correct code.
ASKER
correct code.....
@echo off
set datetime=%date:~-4%_%date: ~-7,2%_%da te:~-10,2% _%time:~0, 2%_%time:~ 3,2%_%time :~6,2%
echo %datetime%
copy "D:\Backup\from DB\backup.bak" "D:\Backup\to CommVault\backup_%datetime %.bak"
@echo off
set datetime=%date:~-4%_%date:
echo %datetime%
copy "D:\Backup\from DB\backup.bak" "D:\Backup\to CommVault\backup_%datetime
ASKER
your script worked well..
you also responded fast..
thanks to help.
little correction required.
copy d:\data\back\backup.audit D:\generation\backup_%date time%.audi t
you also responded fast..
thanks to help.
little correction required.
copy d:\data\back\backup.audit D:\generation\backup_%date
ASKER