Hello to all the community
I've created this one line command, script, to create files lists, that works, though
Code:
ls -R1 /rootpathname/ | while read l; do case $l in *:) d=${l%:};; "") d=;; *) echo "$d/$l";; esac; done > /tmp/filelistname.txt
since I do use it with disks mounted under /media (ubuntu), the files-lists increases in size since at the begin of every line, there is the
string
so I've added some
sed, but the speed slowed down in a terrible manner,
hundreds times slower
here it is the code, though... and it works
Code:
ls -R1 /media/MAC01/ | while read l; do case $l in *:) d=${l%:};; "") d=;; *) echo $d/$l | sed 's/\/media\/MAC01//';; esac; done > /tmp/MAC01-file-list.txt
but this command will take ages against doing it into two steps
Code:
ls -R1 /media/MAC01/ | while read l; do case $l in *:) d=${l%:};; "") d=;; *) echo "$d/$l";; esac; done > /tmp/MAC01-file-list.txt
followed by
Code:
sed 's/\/media\/MAC01//' /tmp/MAC01-file-list.txt > /tmp/MAC01-file-list-cleaned.txt
literally some seconds against many minutes (this drive contains more than 400.000 files, which mean that its files lists' length, is more than 400.000 lines)
Do any of you have an technical explanation about this
enormous speed difference?
Have I placed the
sed command in a wrong position?
Thank you for hinting
Cor