![]() |
|
|
|
|
|||||||
| 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 |
| creating a new file with date stamp | mgirinath | Shell Programming and Scripting | 2 | 02-28-2006 09:00 AM |
| 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
|
|||
|
|||
|
Date Stamp on new file
Dear Gurus,
I'm trying to move a number of files from one directory to another directory with a new date stamp. This is my script: #! /bin/csh Today_Date=`date +%Y%M%D` mv /usr/TRS/data/TS* /usr/TRS/backup/TS*.${Today_Date} when i run the script i'm getting the following errors: mv: /usr/TRS/backup/TS*.20062309/08/06 not found Any advise? Thanks wee |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
what is the date format that u want exactly ?
date +%Y%M%D %M - minute format is of the format YYYYMMMM/DD/YY YYYYMMDD try this, Code:
date +%Y%m%d |
|
#3
|
|||
|
|||
|
hi thanks for the help. i get the date though (see below), but getting another error message:
mv: /usr/TRS/backup/TS*.20060908 not found any advise? thanks again. wee |
|
#4
|
|||
|
|||
|
Quote:
|
|
#5
|
|||
|
|||
|
Quote:
#! /bin/sh Today_Date=`date +%Y%m%d` mkdir /usr/TRS/backup/${Today_Date} mv /usr/TRS/data/T* /usr/TRS/backup/${Today_Date} so now i will create today's date as a directory and put all the files in. the question is how do i remove those directory when they are more than 10 days old? thanks again. |
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
Quote:
#! /bin/sh Today_Date=`date +%Y%m%d` mkdir /usr/TRS/backup/${Today_Date} mv /usr/TRS/data/T* /usr/TRS/backup/${Today_Date} find /usr/TRS/backup/. -name 'T*' -mtime +1 -exec rm -f {} \; |
|||
| Google The UNIX and Linux Forums |