« Struts LookupDispatchAction | Main | The Christmas Story attacked by Newsweek »
December 08, 2004
Picture organizer script
Here's an excerpt of a recent email I got from a friend regarding how to use the ruby picture organizer script:
---------------
you installed ruby?! yay, you're on your way to
becoming a ruby hacker!
after installing ruby for windows, verify that it
works by launcing a command window (Start - Run - cmd)
and typing:
H:\>ruby -v
ruby 1.8.1 (2003-12-25) [i386-cygwin]
Then go to where the ruby script resides and type the
following:
H:\>ruby organizer.rb
usage: organizer.rb [inputdir] [outputdir]
basically the [inputdir] is where all your pictures
are stored. [outputdir] is where all the pictures are
going to be organized. So here's an example:
[inputdir]
d:\my_pix (this contains all your unorganized pix)
[outputdir]
d:\my_organized_pix
Note: make sure that the [outputdir] is not part of
the [inputdir] as a directory within that tree, make
sure that they are in completely separate directories.
If you're paranoid like me when it comes to testing
other people's scripts, try it using a small testcase.
Copy some (about 20 or so) random pictures into a
directory called d:\my_test folder. Create a second
directory called d:\my_organized_pix
then type:
H:\>ruby organizer.rb d:\my_test d:\my_organized_pix
You'll see all your files from d:\my_test moved to
d:\my_organized_pix in their individual directories.
If everything goes ok, try running the script on your
entire picture directory.
Let me know how far you get.
--Patrick
--- Daniel Arcilla <xxxxxxxxxxxxxxxxxxxxx> wrote:
> HI Pat,
>
> i installed Ruby on my home machine, but i don't
> know how to use the
> script you wrote for organizing the digi pics.
>
> Can you send me some instructions?
>
> Thanks.
> Dan
>
Posted by patrick at December 8, 2004 10:42 AM
Comments
SUCCESS! That script worked like a charm! You da man!
Question - does Ruby not like spaces in directory names? I couldn't run it on "My Pictures" but I ran it on "my_pictures."
Anyways - THANKS PAT!!! My pictures are not organized in a matter of seconds!
Daniel
Posted by: Daniel at December 8, 2004 10:53 PM
Dan,
You may have found a bug.. The work around is to specify the directory in quotes, so you would type it like:
ruby organize.rb "d:\My Documents" d:\my_output
--Patrick
Posted by: Patrick at December 8, 2004 11:28 PM
Hey Pat,
Not necessarily a bug - you can look at it as a difference in instructions to the end-user. Just write your documentation to state that for directories with spaces, place the path in quotes.
Great job on the script.
Posted by: daniel at December 9, 2004 09:10 AM