hi all,
here is the description to my problem.
input parameters: $date1 & $date2
based on the range i need to select the archived files from the archived directory and moved them in to working directory.
can u please help me in writing the code to select the multiple files based on the date range.
i need it urgently.today eod is the delivery of the code
Thanks,
Chandu.
rdcwayx
January 21, 2010, 11:43pm
2
you need provide the file name format and date format.
Give some samples to us.
eg: $date1 :20090301
$ date2: 20090502
archivefile dir : /projects/home01/archive/2009/
file names:
20090311_archival.txt
20090312_archival.txt
20090313_archival.txt
20090314_archival.txt
(here is small examle there may be so many files to transfer from archive dir)
need a script to move the files from archive dir to current direct
rdcwayx
January 22, 2010, 12:45am
4
Not tested:
#! /usr/bin/bash
BASE=/projects/home01/archive
DEST=/tmp
for file in `find $BASE -type f -name "*.txt"`
do
date=$(echo $FILE|awk -F[\/_] '{print $(NF-1)}')
if [ "$date" > "$1" && "$date" < "$2" ] ; then
mv $file $DEST/$file
fi
done