Quote:
Originally Posted by
codecaine
You can pipe it to awk
awk '{ print $NF }' FS=/
---------- Post updated at 04:38 PM ---------- Previous update was at 04:34 PM ----------
You can pipe it to awk
find /usr/monitor/text/ -type f -mtime -1 -print | awk '{ print $NF }' FS=/
Thanks a lot the command works but I am getting an other error the basic idea of me using this script is to copy and back up the files , below is my entire code
#!/bin/ksh
#####################################################################################
##### This script is used to copy the dat files from the and copy the latest files from the shared location
#============================================================================
find /home/wasadmin/DatFiles/ -type f -mtime -1 -print | awk '{ print $NF }' FS=/ | while read filename
do
echo $filename
# Remove the Existing back-up DAT files
rm /usr/IBM/WebSphere/AV/backup_"${filename}"
mv /usr/IBM/WebSphere/AV/"${filename}" /usr/IBM/WebSphere/AV/backup_"${filename}"
# Copy files preserving permissions and create any directory needed
echo "${filename}"|cpio -pdumv /usr/IBM/WebSphere/AV; ERROR=$?
done
if [ $ERROR = 0 ]
then
mail -s "Copy of the latest Dat files Successful on $date" -c raokl@yahoo.com
else
mail -s "Copy of the latest Dat failed for:${filename}on $date" -c raokl@yahoo.com
fi
When i run this it is giving me the output as
cpio: 0511-025 Cannot get information about avvclean.dat.
0 blocks
avvnames.dat
I have checked out for the owner and other permissions they are correct , can you please let me know if i missing some where
---------- Post updated at 03:55 PM ---------- Previous update was at 03:54 PM ----------
Quote:
Originally Posted by
BeefStu
you can cd to the directory you like and do something like this:
find . -type -print
The problem is that find walks down the directories, therefore if you have
a directory in your path you will get output like this
dir/file1
dir/file2
.....
You may want to consider outputing your results to a file, than reading
the conetents of the file line by line and calling 'basename' on each line. That will give you your desired results.
Keep in mind, you can have the same file name in different directories and
they can be differnt files.
Good luck
Thank you very much