Archiving Perl PHP RUBY Scripts to Evernote using File Auto Import and Some Perl Scripting
Archiving Perl PHP RUBY Scripts to Evernote using File Auto Import and Some Perl Scripting
Today Evernote released a new version which added the ability to drag and drop pictures or text files directly to evernote.
For a while I’ve been thinking about putting all my perl scripts in evernote, but was not in the mood to
1) Open each file
2) Copy the text
3) Paste It to Evernote
Thats also repetiteve and I don’t do Repetitive without Perl!
Evernote Offers a nice little feature File Auto Import which can be found in the menus under
Account > Properties.
The problem is, It will not import .pl file or .cgi or .php for that matter. Only .txt and images, and maybe a few others but
definitely not .pl

So, I wrote a perl script that goes through my perl script parent directory.
NOTE:(I store all my scripts for the most part in one dir, and create sub directories under it. So It was quite easy for me.)
And then makes a copy of the file in the Evernote AutoImport directory with a nice Title and the .txt extension.

##This is the path to your Evernote Import Directory $outdir = "C:\\temp\\EvernoteScripts"; # look in current directory $dir = `pwd`; chop($dir); my @files = `find | grep ".pl" | grep -v ".swp" | grep -v ".doc"`; foreach my $f (@files) { chop($f); $filenameOnly = `basename $f`; $directoryOnly = `dirname $f`; $newfile = substr($filenameOnly,0,index($filenameOnly,".")); print "$filenameOnly\n"; $text = "\# Script : $filenameOnly\n"; ### Creates a title for the script which will be seen in Evernote! $text = $text . `cat $f`; $nf = "$outdir\\$newfile\.txt"; open FILE, ">", $nf or die $!; print FILE "$text"; close FILE; sleep 2; ###Evernote basically exploded when it tried to read from the directory without a slight delay. }


Leave a Reply