Been working since 25+ hrs: Bash Script to rename files supposedly direct but difficult to execute

:wall::wall::wall:

Hi I have horrible script below, need help in renaming ls -l output into new filename format:

Desired output:

cp -pv original_path/.* newDirectory/owner_of_file.%dd%mm%y.file_extension.first_8_characters_of_original_filename

 
localuser@localuser:~ vi renamefiles.sh
 
#!/bin/bash
 
a=alice
t=ted
c=carol
b=bob
date=$(ls -l --time-style="+%m %d %y" wiz | egrep -f alice.filenames | grep defs | sed 's/.defs/ /g' | awk '{print $6$7$8}')
mkdir -pv newWiz/large newWiz/small newWiz/alice/large newWiz/alice/small
for largefiles in $(cat alice.large | sed 's/\.defs$//g' | awk '{print $NF}' | cut -c1-8)
do
        echo -e $a$date$largfiles ;
done
 

---------- Post updated at 01:46 PM ---------- Previous update was at 01:44 PM ----------

cat list.txt #sample out from ls -l
-rwx------- 1 alice staff 1586 2010-11-05 02:27 request-key.conf
-rwx------- 1 ted staff 126 2011-04-29 13:54 cvs-pserver.conf
-rwx------- 1 carol staff 644 2011-03-06 21:58 ts.conf

---------- Post updated at 01:47 PM ---------- Previous update was at 01:46 PM ----------

so far I have extracted the date, owner, and first 8 characters

However I figured out how can I combine them accordingly without overlapping each output results??? :wall:

I don't know how you expect to avoid duplicates with that naming scheme. If there are duplicates, what should be done about it?

duplicates is ok as long as I can produce those files

disregard echo line

I think it should be

 touch $owner$modifieddate$file_extension$truncatedfilename 

How about something like this:

stat --format='%U %Y %n' wiz/* | while read uid time name
do   
  fname=$(basename $name)
  prefix=${fname%.*}  
  ext=${fname##*.}
  newname=$uid.$(date -d @$time +%d%m%Y).${ext}.${prefix:0:8}
  echo cp $name newWiz/$newname
done