1 (edited by fmotta 2015-03-25 23:39:30)

Topic: Quick hack script to do part of what a version control system can do

I grew tired of manually doing what should be done automatically if we had the STL files in a version control system.  This hacked script has worked for me and is likely not great - but I do not have to manually click each file and mentally keep track of which ones I downloaded.


#!/bin/bash
rm -f printables.html
url="http://files not releasedyet"

wget $url
files=`grep zip printables.html | awk 'BEGIN{FS="\"";}{print $6}' | grep -v href`
for f in $files; do
    echo "Downloading File $f"
    wget $f
done

NOTE: I added a like to remove any pre-existing printables.html in hopes to prevent use of an old file.

WRT Atlas3D

2

Re: Quick hack script to do part of what a version control system can do

I did a quick edit since the files have not been released to the public.
I think most will know what to put in for the URL.

Printit Industries Model 8.10 fully enclosed CoreXY, Chamber heat
3-SD3's & a Workbench all fully enclosed, RH-Slic3r Win7pro, E3D V6, Volcano & Cyclops Hot End
SSR/500W AC Heated Glass Bed, Linear bearings on SS rods. Direct Drive Y-axis, BulldogXL
Thanks to all for your contributions

3

Re: Quick hack script to do part of what a version control system can do

I'm not a boffin at shell stuff, so I amy have messed up. 

This is what I got:

G-MBP:LaserParts graham$ ls
Atlas3d.sh            left_frame_section_3-2.stl
F9GZSUMI5MD0Q20.stl        left_frame_section_3.stl
FC85TRAI5MD0Q21.stl        left_laser_arm.stl
FRINO86I5MD0Q22.stl        left_laser_holder.stl
camera_arm.stl            right_frame_section_3-2.stl
camera_bracket.stl        right_frame_section_3.stl
camera_bracket_no_support.stl    right_laser_arm.stl
camera_case_back.stl        right_laser_holder.stl
camera_case_front.stl        rpi_cable_carrier.stl
camera_shaft.stl        rpi_case_bplus_lower.stl
camera_tower.stl        rpi_case_bplus_upper.stl
camera_tower_front_plate.stl    table_coupler.stl
cross_bar.stl            turn_table_d4.stl
frame_connector.stl        turn_table_d5p5.stl
frame_section_2.stl        turn_table_d7p5.stl
G-MBP:LaserParts graham$ sudo ./Atlas3d

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
sudo: ./Atlas3d: command not found
G-MBP:LaserParts graham$ sudo ./Atlas3d.sh
--2015-03-25 15:53:51--  https://s3.amazonaws.com/atlas3d/
Resolving s3.amazonaws.com... 54.231.244.8
Connecting to s3.amazonaws.com|54.231.244.8|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2015-03-25 15:53:52 ERROR 403: Forbidden.

grep: printables.html: No such file or directory
G-MBP:LaserParts graham$

4 (edited by fmotta 2015-03-25 23:45:53)

Re: Quick hack script to do part of what a version control system can do

graham wrote:

I'm not a boffin at shell stuff, so I amy have messed up. 

This is what I got:

G-MBP:LaserParts graham$ ls
Atlas3d.sh            left_frame_section_3-2.stl
F9GZSUMI5MD0Q20.stl        left_frame_section_3.stl
FC85TRAI5MD0Q21.stl        left_laser_arm.stl
FRINO86I5MD0Q22.stl        left_laser_holder.stl
camera_arm.stl            right_frame_section_3-2.stl
camera_bracket.stl        right_frame_section_3.stl
camera_bracket_no_support.stl    right_laser_arm.stl
camera_case_back.stl        right_laser_holder.stl
camera_case_front.stl        rpi_cable_carrier.stl
camera_shaft.stl        rpi_case_bplus_lower.stl
camera_tower.stl        rpi_case_bplus_upper.stl
camera_tower_front_plate.stl    table_coupler.stl
cross_bar.stl            turn_table_d4.stl
frame_connector.stl        turn_table_d5p5.stl
frame_section_2.stl        turn_table_d7p5.stl
G-MBP:LaserParts graham$ sudo ./Atlas3d

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
sudo: ./Atlas3d: command not found
G-MBP:LaserParts graham$ sudo ./Atlas3d.sh
--2015-03-25 15:53:51--  https://s3.amazonaws.com/atlas3d/
Resolving s3.amazonaws.com... 54.231.244.8
Connecting to s3.amazonaws.com|54.231.244.8|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2015-03-25 15:53:52 ERROR 403: Forbidden.

grep: printables.html: No such file or directory
G-MBP:LaserParts graham$

OK - well, I did not sudo this (however, it should work that way too).  I ran it on OSX as well.  I just ran a successful test on Ubuntu.  But, I tried to make it use common point tools that is on most POSIX systems.

I am guessing that the moderators change caused it to fail as I think he was protecting the files by removing the URL and adding a bogus one.  You should have the correct value for the 'url' variable available at the Kickstarter website/update.  Find that and change the script to have that URL.  I think I should not offer it again as the moderator redacted it.

Another thought is that bash can be sensitive to line ending.  if you used an odd editor (I only use vi) then maybe it has some DOS guck at the end of lines and needs 'dos2unix' filtering.

5 (edited by Frozen 2015-03-26 07:46:42)

Re: Quick hack script to do part of what a version control system can do

graham, the problem is that's not the right site wink look for the link with "printables.html" in it wink



edit: graham, not fmotta


also, make sure after creating the shell script, you run chmod 755 on it so that it becomes executable.

e.g. my script was named "latest.sh" in a folder named "Atlas3D" on my Desktop , so I ran chmod 755 ~/Desktop/Atlas3D/latest.sh

then

cd ~/Desktop/Atlas3D/

then

./latest.sh



smile

6 (edited by graham 2015-04-05 00:57:07)

Re: Quick hack script to do part of what a version control system can do

Thanks folks!

Now I see what you are doing :-)

Cheers

7

Re: Quick hack script to do part of what a version control system can do

graham wrote:

Thanks folks!

Now I see what you are doing :-)

Cheers


And it works like a dream!  One enhancement - remove the zip files when completed?

Cheers