I need a program and I think a shell program will work.
I need a program that will read each line and copy a specific JPEG to a folder and rename it sequentially as it copies them. It has to be in the order that the list.txt is in.
I have had some luck with writing a shell script for it.
I have a text file named list.txt
it looks exactly like this when you open it
and the picture that each of these contains is a picture of the letter or number or punctuation.
the files above write "beginning god created", but I want to do this to a book. or anything else I want.
I have been using these commands
This sorta successfully copies the files listed in list.txt but won't copy a file with the same name in the same folder.
The date/time when it was copied to the folder on each file isn't accurate because of the duplicate file name issue.
Since I am only using pictures of the 26 letters and 10 numbers and punctuation of the alphabet, I will obviously be running into the duplicate file name issue, I will be copying the same files many times over depending on the text in list.txt
So I figure that I need to rename them as they are pasted in the new folder.
So I use this to rename them.
This successfully renames the original JPEG's, but in the wrong folder and I need the ones copied to be renamed, not the source JPEG's
and finally this piece to somehow combine them
Ive tried all kinds of mutations to get it to work and it looks something like this
what am i missing? and doing wrong? I also need it to wait for each JPEG to be copied and renamed before going to the next line in list.txt
I need the files copied and renamed in order. If you help me, treat me stupid when it comes to programming, because I am pretty much clueless.
I need a program that will read each line and copy a specific JPEG to a folder and rename it sequentially as it copies them. It has to be in the order that the list.txt is in.
I have had some luck with writing a shell script for it.
I have a text file named list.txt
it looks exactly like this when you open it
and the picture that each of these contains is a picture of the letter or number or punctuation.
Code:
b.jpeg
e.jpeg
g.jpeg
i.jpeg
n.jpeg
n.jpeg
i.jpeg
n.jpeg
g.jpeg
spacebar.jpeg
g.jpeg
o.jpeg
d.jpeg
spacebar.jpeg
c.jpeg
r.jpeg
e.jpeg
a.jpeg
t.jpeg
e.jpeg
d.jpeg
the files above write "beginning god created", but I want to do this to a book. or anything else I want.
I have been using these commands
Code:
cp `cat list.txt` new-folder/
The date/time when it was copied to the folder on each file isn't accurate because of the duplicate file name issue.
Since I am only using pictures of the 26 letters and 10 numbers and punctuation of the alphabet, I will obviously be running into the duplicate file name issue, I will be copying the same files many times over depending on the text in list.txt
So I figure that I need to rename them as they are pasted in the new folder.
So I use this to rename them.
Code:
find . -name '*.jpeg' \
| awk 'BEGIN{ a=0 }{ printf "mv %s %04d.jpeg\n", $0, a++ }' \
| bash
This successfully renames the original JPEG's, but in the wrong folder and I need the ones copied to be renamed, not the source JPEG's
and finally this piece to somehow combine them
Code:
cat [filename] | while read line; do [command] "$line"; done
Ive tried all kinds of mutations to get it to work and it looks something like this
Code:
cd Desktop/test
cp `cat list.txt` new-folder/ | while read line; do find . -name '*.jpeg' | awk 'BEGIN{ a=0 }{ printf "mv %s %04d.jpeg\n", $0, a++ }' | bash "$line"; done
what am i missing? and doing wrong? I also need it to wait for each JPEG to be copied and renamed before going to the next line in list.txt
I need the files copied and renamed in order. If you help me, treat me stupid when it comes to programming, because I am pretty much clueless.
Last edited: