Originally posted by: chauhan_vin1
Hi,
I have a requirement to tar and then gzip a all the files under a certain directory starting with System*.
These files needs to be put into a different directory ( Directory name should be timestamp).
I am writing the below shell script but I am not getting the zipped file created under a directory , instead I am getting a file copied with the directory name as the name of the file.
I think I am missing some thing due to which its not taking the directory name :
Please see my script below :
#!/bin/sh
CUR_DATE=`date +%Y%m%d`
CUR_TIME=`date +%H%M`
mkdir "$CUR_DATE"-"$CUR_TIME"
tar -cvf MDA_WPS_SysOutLogs.tar
gzip MDA_WPS_SysOutLogs.tar
cp MDA_WPS_SysOutLogs.tar.gz /wpsdev01/MDA/DevLogs/"$CUR_DATE"-"$CUR_TIME"/
I want to get the same file MDA_WPS_SysOutLogs.tar.gz to be copied to /wpsdev01/MDA/DevLogs/20081020-1705/ directory , where '20081020-1705' is the Date-timestamp directory created by my script.
but what I am getting is a gz file created under /wpsdev01/MDA/DevLogs/ with the mane as 20081020-1705
Please help me with this :-
Thanks,
Vineet