I have a really simple task.
I have a CSV file with 2 columns: "picture-path" (the current name of a .jpg file) and "ID" (i.e., the future name of the jpg file). See below and the attached file.
I would like a script which does something very simple: it makes a copy of the file in “picture-path,” gives it the “ID” name, and outputs it (i.e. saves it) to a new folder (“davesfolder”). That’s it.
(For the sake of simplicity, I will keep the script, the picture files, and the CSV file all in the same folder.)
I’ve attached a sample CSV. Here is what it looks like:
Picture-path | ID
[url removed, login to view] | Harley-Sissy-Bar
[url removed, login to view] | Yamaha-Sissy-Bar
[url removed, login to view] | Suzuki-Sissy-Bar
A successful script should do the following:
a) It makes a copy of "[url removed, login to view]," names it "Harley-Sissy-Bar.jpg" and outputs it (i.e. saves the copy) to “davesfolder”
b) It makes a copy of "[url removed, login to view]," names it "Yamaha-Sissy-Bar.jpg" and outputs it (i.e. saves the copy) to "davesfolder"
c) It makes a copy of "[url removed, login to view]," names it "Suzuki-Sissy-Bar.jpg" and outputs it to "davesfolder"
I don’t care what programming language you use. I just need something that is so simple to use that an idiot could do it. All the steps needed to run the script successfully should be explicitly spelled out so that your Grandmother could do it if she had to. (Please send back the script as a separate attachment)
IMPORTANT: I have a Macintosh Powerbook running OS X. The Mac has a UNIX bash shell. The successful script should be able to be run on the Macintosh OS X platform
Please ask all the questions you want if something is unclear
I did try writing a KSH script (unix scripting language) to do this task. It didn’t work. I’ll include the code below. Feel free to use it, or start from scratch. Again, I want something ridiculously easy to use.
Here is the old code for reference:
Below is the script I modified you spreadsheet slightly getting rid of all columns that had commas inbedded in the text in them you also may want to clip the first row from you spread sheet getting rid of the columns names and then resave it as a csv file again
name it [url removed, login to view] or edit the script which ever you prefer.
Uncoment to line with a # in the first column and you should be ready to go
run it like so
Name the script [url removed, login to view] give excute permission
like so you c
$ chmod 777 [url removed, login to view]
$ ./[url removed, login to view]
Any how below is the script you can run you can pipe the script to more if you want to see
everything it does
while read A descriptivename C D E F G H I J K L M N
tpn=`echo $J | sed s/http://`
echo "cp $tpn $descriptivefolder/$descriptivename"
#cp $tpn $discriptivename *** uncomment me when you are ready to run it fur sure
done < [url removed, login to view]
7 freelanceria on tarjonnut keskimäärin 54 $ tähän työhön
hello sir, i prefer to use php for processing your csv file. yes, php running from the unix shell (not from web). please read my pmb for more detailed bid information. Thank you, Harry S. Kartono