mercredi 25 août 2021

How to insert multiple files into a single ext program in BASH

I have a simple problem and I need your help.

I want the files in a specific folder, conditionally '1.txt', '2.txt', 'and three.txt' whose sizes are also conditional 1kb, 3mb, 55kb. There are thousands of files that I can do this manually. I want to insert all the above mentioned files in dd command, to be produced with the same name and size.

find . -name "*.txt" -print | while IFS= read -r fn
do
        echo "$fn"
done
size=$(ls -nl *.txt | awk '{print $5}')
for size in $size
do
        echo "$size"
done

exec dd if=/dev/random of=$fn bs=$size count=1"

I want something like that, thanks in advance.




Aucun commentaire:

Enregistrer un commentaire