![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Zip the files from date Stamp to end date Stamp | redlotus72 | UNIX for Dummies Questions & Answers | 1 | 12-08-2006 03:29 PM |
| Date Stamp on new file | lweegp | Shell Programming and Scripting | 14 | 10-03-2006 08:47 PM |
| Inserting Date&Time Stamp In Existing Log File | shephardfamily | UNIX for Dummies Questions & Answers | 3 | 02-24-2006 01:01 AM |
| ftp copy: preserve source file date stamp | cassj | UNIX for Dummies Questions & Answers | 5 | 02-16-2005 03:38 PM |
| File date and time stamp | Xenon | UNIX for Dummies Questions & Answers | 1 | 10-09-2001 12:58 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
creating a new file with date stamp
Hi,
can any one tell me how to achieve this...I will input the path and file name and it should rename it to current date and time... this is what I tried... Code:
#! /usr/bin/sh
set -x
cd /info_stg/vul/Scripts
TODAY_DATE_TIME=`date +%Y%m%d%H%M%S`
IN_FILE_PATH=`cat file.txt | awk -F, '{ print $1 }'`
OUT_FILE_PATH=`cat file.txt | awk -F, '{ print $3 }'`
IN_FILE=`cat file.txt | awk -F, '{ print $2 }'`
OUT_FILE=`cat file.txt | awk -F, '{ print $4 }'`
cp ${IN_FILE_PATH}${IN_FILE} ${OUT_FILE_PATH}${OUT_FILE}.${TODAY_DATE_TIME}
chmod 755 ${OUT_FILE_PATH}${OUT_FILE}.${TODAY_DATE_TIME}
file.txt has sourceloc,srcfilename,destloc,destfilename
like... script_change_File_Name.sh < /path/for/src/file.txt and this should give me file.txt.todaysdatetime please advise. Thanks, |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
#!/bin/ksh mv $1 $1`date +%Y%m%d%H%M%S` |
|
#3
|
|||
|
|||
|
it worked thanks...
|
|||
| Google The UNIX and Linux Forums |