terramir Posted September 29, 2011 Share Posted September 29, 2011 used to do this in windowz and well my main doesn't run windowz anymore at least not 24/7 lol. Here's the deal I started like this in code #!/bin/sh cd ~/Documents/pictures/ wget [url="http://thiswebsite.com/pictures/pic1.jpg"]http://thiswebsite.com/pictures/pic1.jpg[/url] wget [url="http://thiswebsite.com/pictures/pic2.jpg"]http://thiswebsite.com/pictures/pic2.jpg[/url] wget [url="http://thiswebsite.com/pictures/pic3.jpg"]http://thiswebsite.com/pictures/pic3.jpg[/url] etc...... wget [url="http://thiswebsite.com/pictures/pic17.jpg"]http://thiswebsite.com/pictures/pic17.jpg[/url] I once upon a time wrote a script that actually did exactly what I wanted to do namely not just download the 17 pictures that change every so often but append the name to reflect the date and time downloaded as well as preserve the original filename part. since I dun remember the syntax I'll have to write mock code and hope you guys can help me out. echo=off cd ~/Documents/pictures/ For x$=(pic1,pic2,pic3,pic4,........,pic17) do wget [url="http://thiswebsite.com/pictures/`x$`.jpg;"]http://thiswebsite.com/pictures/`x$`.jpg;[/url] call rename; done Rename ren `x$`.jpg x$`date (mm,dd,yy,hh,min,(am/pm)).jpg return end I googled on the web about appending filenames but everyone I read just showed examples of the date, also I'mma not sure if you can do in darwin the for do done loop with a call to a subroutine embedded like this. so honestly I am throughly confused. and need some help. renaming the files manually would take forever and would be a pain. this would be the best solution if someone can help translate my mock code into unix commandline help terramir Link to comment Share on other sites More sharing options...
Airr Posted October 21, 2011 Share Posted October 21, 2011 I *think* it can be done like this: #!/bin/sh declare -a PICS=('pic1' 'pic2' 'pic3' 'pic4'); for x in ${PICS[@]}; do wget "http://thiswebsite.com/pictures/$x.jpg" mv "$x.jpg" "$x-`date +"%m-%d-%y_%H:%M%p"`.jpg done Link to comment Share on other sites More sharing options...
Recommended Posts