How to Pull out multiple files from DB table and redirect all those files to a differetn directory?

Hi everyone!!

I have a database table, which has file_name as one of its fields.
Example:

File_ID File_Name Directory Size
0001 UNO_1232 /apps/opt 234
0002 UNO_1234 /apps/opt 788
0003 UNO_1235 /apps/opt 897
0004 UNO_1236 /apps/opt 568

I have to extract all the files whose size is greater than 500 and send all those files to a different directory /apps/opt/new

How do I loop through the table and send all those file_names, which match the size criteria to a different directory?

Thanks in advance..
Please do help me out, as this is very urgent for me.

What DB do you have?

Thanks for ur reply Jim..

I ve got DB2 database

Something like this?

$ awk 'NR>1 {if($4>500) print "cp ",$3"/"$2,$3"/new/"$2} ' ur_table_file
cp  /apps/opt/UNO_1234 /apps/opt/new/UNO_1234
cp  /apps/opt/UNO_1235 /apps/opt/new/UNO_1235
cp  /apps/opt/UNO_1236 /apps/opt/new/UNO_1236

you can export the output to a file, and add x permission on it, then run it.