How to add filepath to filename when moving it?

Hi

I have a cron job setup that searches for 'core dump' files in a fixed set of directories and moves the core files to a separate file system.
I am able to add date and time info to the file name.
How can I add the source directory path to the file name?
In case anyone is wondering why I need to know this, it's because the support personnel demand to know the location where the core was collected from.

Here's the command in my cron job:
find /var/mqsi/ -name core -type f -exec mv '{}' /corefile/core_$(date +%Y%m%d-%H%M%S) \;

Thanks in advance.

You'll need to incorporate a processing block.
For example (untested):

find /var/mqsi/ -type f -name core -print | while read filename
do
      # Converted solidus in filename to underscore
      location=`echo "${filename}"|sed -e "sX/X_Xg"`
      mv "${filename}" "/corefile/core_$(date +%Y%m%d-%H%M%S)_${location}"
done

Before removing a file called "core" it is important to know whether it contains a core dump. Use the unix "file" command to determine the file type. When you type "man core" just imagine whether there are any vulnerable files. Some unix systems have a critical package called "core" - be careful.

To be more specific we would need to know precisely what Operating System and Shell you have. The output from "file core" on a typical core file is very helpful.

find /var/mqsi/ -name core 2>/dev/null | while read x; do d=$(echo ${x%/*} | sed 's/\//_/g'); echo "$x" "/corefile/core$d"$(date +%Y%m%d-%H%M%S);done

Replace echo with mv if you're OK with this solution.

For Solaris:

man coreadm

For Linux, this might work:

Capturing core files in Red Hat Enterprise Linux | Golden Apple Enterprises Ltd.

My OS is SLES v11.

Worked flawlessly. All I added was an underscore before the date variable.
Thanks a lot Tukuyomi.