I am trying to extract the size and filename from a group of files. Normally I would just do an ls -alR combined with an awk ‘{print %5" "$9}’. However this doesn’t work with filename with spaces.
I found some things from a google search but they don’t work either. Here is other things I have tried.
ind /home/glrider/A53Music/Comedy -maxdepth 2 -type f -name “*.mp3” | while read name
do
echo $name
name=‘"’$name’"’
echo $name
ls -al $name
done
or
clear
cd ‘/run/user/1000/gvfs/mtp:host=SAMSUNG_SAMSUNG_Android_R5CT62NC5EN/Internal storage/Music/Comedy’
find . -name “Jerky Boys - Denta*.mp3” > /tmp/a53.lst1
cat /tmp/a53.lst1 |
while read line
do
newline=“'”$line"'"
echo “newline=”$newline
filesize=ls -al $newline | awk '{print $5}'
echo $line
done
exit
All situations end with ls dealing with the filename as separate files, even with single quotes or double quotes wrapped around it.