And if you want index to have 7 digits, change %06d to %07d
And a question, what does the complete script look like?
Because what skrynesaver and i posted didnt have 9 lines of code, but your output fails on line 9 of the script.
#!/bin/bash
SOURCES="$HOME/Desktop/sourcepictures"
TARGET="$HOME/Desktop/orderedpictures"
LIST="$HOME/Desktop/sourcepictures/list.txt"
index="0000000"
for image in $(cat $LIST) ; do
ln -s $SOURCES/$image $TARGET/$index.jpeg
index=$(printf %06d $(( $index + 1 )) )
done
and it worked up to a point, 8 pictures successfully in order in the orderedpictures folder
and then it said this, the files listed in list.txt is longer then 8 pictures, it is going to be any text i want
this text in list.txt is just a test text for the timelapse, when the script works in full then i will add much longer text the way it is in list.txt
when i ran the code above is did 8 pictures in order and then stopped
Last login: Mon Jan 19 16:11:55 on ttys000
timothys-mbp:~ timothynorris$ /Users/timothynorris/Desktop/test.command ; exit;
/Users/timothynorris/Desktop/test.command: line 9: 000008: value too great for base (error token is "000008")
ln: /Users/timothynorris/Desktop/orderedpictures/.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000001.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000002.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000003.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000004.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000005.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000006.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000007.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000008.jpeg: File exists
/Users/timothynorris/Desktop/test.command: line 9: 000008: value too great for base (error token is "000008")
ln: /Users/timothynorris/Desktop/orderedpictures/.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000001.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000002.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000003.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000004.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000005.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000006.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000007.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000008.jpeg: File exists
/Users/timothynorris/Desktop/test.command: line 9: 000008: value too great for base (error token is "000008")
ln: /Users/timothynorris/Desktop/orderedpictures/.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000001.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000002.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000003.jpeg: File exists
ln: /Users/timothynorris/Desktop/orderedpictures/000004.jpeg: File exists
logout
[Process completed]
and when I add the f to -s
#!/bin/bash
SOURCES="$HOME/Desktop/sourcepictures"
TARGET="$HOME/Desktop/orderedpictures"
LIST="$HOME/Desktop/sourcepictures/list.txt"
index="0000000"
for image in $(cat $LIST) ; do
ln -sf $SOURCES/$image $TARGET/$index.jpeg
index=$(printf %06d $(( $index + 1 )) )
done
it doesnt copy them in order to the orderedpictures folder and it still stops at 8 pictures
Last login: Mon Jan 19 16:13:20 on ttys000
timothys-mbp:~ timothynorris$ /Users/timothynorris/Desktop/test.command ; exit;
/Users/timothynorris/Desktop/test.command: line 9: 000008: value too great for base (error token is "000008")
/Users/timothynorris/Desktop/test.command: line 9: 000008: value too great for base (error token is "000008")
/Users/timothynorris/Desktop/test.command: line 9: 000008: value too great for base (error token is "000008")
logout
[Process completed]
the code i used is the same thing that you guys provided
i ran this and it ran.............................PERFECT:cool:
#!/bin/bash
SOURCES="$HOME/Desktop/sourcepictures"
TARGET="$HOME/Desktop/orderedpictures"
LIST="$HOME/Desktop/sourcepictures/list.txt"
index="0"
holder=0000000
for image in $(cat $LIST) ; do
link=${holder:${#index}}$index
ln -sf $SOURCES/$image $TARGET/$link.jpeg
index=$(( $index + 1 ))
done
there were only 32 files listed in list.txt and it did what it was supposed to with all of them and in order, now to test it on a list.txt that has 1000