Code:
#!/bin/ksh
cd /your/directory/goes/here
TODAY=`date '+%y%m%d'`
for OLD_NAME in `ls -1 *.sh`
do
NEW_NAME=`echo $OLD_NAME | sed "s/\./_$TODAY./"`
CONNECT_TO_DB <<- END_SQL
insert MyTable
values ( "$NEW_NAME" )
go
END_SQL
done
exit 0
If you just want a shell script to store the filenames, with a date, in a table then the above should work fine. You'll need to :
- set the correct directory
- check the syntax for the insert (I haven't done Oracle for a long time)
- put in the correct command and params to access your database from shell.
Mike