I have written a plsql procedure using utl file to create files in the temp directory in Unix.I am sending the names of the files to a shell script to mail these files and delete after mailing from temp directory, it is working good but when two people running the same request with the same files, the files are replaced and deleted by the first program and the second program not having any files in the directory to mail. I decided to create file names_request_id to make file names unique, but my actual requirement is to get the files with the same name with out request_id to person who is receiving email.I created Incompatibility for the program with the same program but they want me to take away the incompatibility to save time.What other options do I have?For your reference i copied my whole shell script and added ####### symbol to denote the location of the code to be modified.The files are moved to the created directory and the file names have reuest_id-filename.extension  so that request_id and the '-' must be removed and the actual filename should be there.name of the file in the database: 23456663-abcd.pdfrequired name of the filename   : abcd.pdfparam=`echo $*`#getting input valuesecho params : $paramv_temp=`echo $param  | cut -d '' -f 1 `v_temp=`echo $v_temp | cut -d '=' -f 2 `v_temp=`echo $v_temp | cut -d ' ' -f 1 `#now v_temp has the request_idv_temp=MUILT_EMAIL3-$v_tempecho temp file is : $v_temp#split the parameter string with  as seperatorv_email_list=`echo $param | cut -d '' -f 8 `v_file_list=`echo $param | cut -d '' -f 10 `v_subject=`echo $param | cut -d '' -f 12 `v_mail_content=`echo $param | cut -d '' -f 14 `v_reply_to=`echo $param | cut -d '' -f 16 `v_delete_attachment_files=`echo $1|cut -d'' -f18`v_outputfile_path=`echo $1|cut -d'' -f20`v_outputfile=`echo $1|cut -d'' -f22`v_request_id=`echo $1|cut -d'' -f24`#v_rename_file=`echo $param | cut -d '' -f 24 `echo email list : $v_email_listecho file list : $v_file_listecho subject : $v_subjectecho mail_content : $v_mail_contentecho reply_to : $v_reply_toecho delete_attachment_files : $v_delete_attachment_filesecho outputfile_path : $v_outputfile_pathecho outputfile : $v_outputfileecho request_id : $v_request_idv_email_list=`echo $v_email_list |tr ;  `v_file_list=`echo $v_file_list |tr ;  `pwdcd /mkdir /tmp/$v_request_idcp $v_outputfile_path /tmp/$v_request_id/$v_outputfilemv /tmp/$v_request_id* /tmp/$v_request_id/ cd /tmp/$v_request_id/###### this is the place i need to rename the files that are moved to a request_id dir################# mv -- 34178248-2640006.pdf ${34178248-2640006.pdf} v_mail_content =`basename $v_mail_content`cat $v_mail_content > /tmp/${v_temp}.tmpecho File List : $v_file_listfor i in ${v_file_list}; do    echo File to attach before parsing $i    v_attachment_name=`echo $i |awk '{ if ( index($1,:)> 0) { print substr($1,index($1,:)+1) } }'`    v_attachment_file=`echo $i |awk '{ if ( index($1,:)> 0) { print substr($1,1,index($1,:)-1) } }'`    echo Checking attachment name after parse :$v_attachment_name    if [ $v_attachment_name = '' ]      then      v_attachment_name=`basename $i`      v_attachment_file=$i      echo base name is  $v_attachment_name    fi    /usr/bin/uuencode $v_attachment_file $v_attachment_name >> /tmp/${v_temp}.tmpdoneecho Loop doneif [ ${v_reply_to} = '' ]  then  mailx -s ${v_subject} ${v_email_list} < /tmp/${v_temp}.tmp#echo something | mailx -s ${v_subject} ${v_email_list} < /tmp/${v_temp}.tmpelse  mailx -r ${v_reply_to} -s ${v_subject} ${v_email_list} < /tmp/${v_temp}.tmp#echo something | mailx -r ${v_reply_to} -s ${v_subject} ${v_email_list} < /tmp/${v_temp}.tmpfiecho mailing done#delete the temporary files  echo deleting file /tmp/${v_temp}.tmprm /tmp/${v_temp}.tmpif [ ${v_delete_attachment_files} = 'Y' ]  then    echo deleting attached files -start     #Loop through to identify all the attachments and delete    for i in ${v_file_list}; do        echo $i        v_attachment_name=`echo $i |awk '{ if ( index($1,:)> 0) { print substr($1,index($1,:)+1) } }'`        v_attachment_file=`echo $i |awk '{ if ( index($1,:)> 0) { print substr($1,1,index($1,:)-1) } }'`        echo Check :$v_attachment_name        if [ $v_attachment_name = '' ]          then          v_attachment_name=`basename $i`          v_attachment_file=$i          echo base name is  $v_attachment_name        fi        echo deleting file $v_attachment_file        rm $v_attachment_file    done    #End Loop through to identify all the attachments and deletefiecho rm done
Renaming or making filenames unique
bash;shell script;files