Jump to content
SteveJam

Import several hundred notes with their creation date - OSX

Recommended Posts

Folks,

After a short stint away from EN during the turmoil of the past few months, have decided to return to the fold.

Have several hundred text documents and PDFs which I need to import to EN.  Dragging them into EN gives them a creation date of Today.  Is there some way to import them which can respect the creation date? I *do not* want to do this manually.  

Steve J

Share this post


Link to post
17 minutes ago, SteveJam said:

Is there some way to import them which can respect the creation date? I *do not* want to do this manually.  

Applescript to get the file and creation date from Finder, and import the file to Evernote

When the note is created, attributes like creation date can be set

Share this post


Link to post
1 hour ago, SteveJam said:

Any ready-made Applescripts out there? Wouldn't have a clue how to create one.

Here's something I whipped up to get you started   Import_Files.scpt58cdff013e4bd_ScreenShot2017-03-18at8_44_25PM.png.4c0d6a1e4175ff51638bc3a3dcb571a3.png
I have not done extensive testing

  • Download the file to your Mac
  •  double click the file to run Script Editor
  • edit the folder name
  • click on run

tell application "Finder"

    set theFiles to files of folder POSIX file ("/Users/david/Desktop/test")     <<< hard coded folder name

    repeat with theFile in theFiles

        if name of theFile as string is not ".DS_Store" then

            set theCreationDate to creation date of theFile
            set
theFile to "/Users/david/Desktop/test/" & name of theFile          <<< hard coded folder name

            tell application "Evernote"
                set theNote to create note from file theFile                                   <<< create the note
                set creation date of theNote to theCreationDate                           <<< set the creation date
            end tell          

        end if

    end repeat

end tell

 

Share this post


Link to post

DTLow,

So I replace "/Users/david/Desktop/test" in both locations in the script with the location of the folder of my choice on the Desktop?

E.g.: /Users/MeTheUser/Desktop/TESTimportEN

If I do this, I get the error:

Error Number: 3

Evernote got an error: File does not exist.

 

SteveJ

 

set theFiles to files of folder POSIX file ("/Users/david/Desktop/test")     <<< hard coded folder name

Share this post


Link to post
12 minutes ago, SteveJam said:

E.g.: /Users/MeTheUser/Desktop/TESTimportEN

If I do this, I get the error:

I changed the name of my folder tp TESTimportEN and it works for me
Are you sure about MeTheUser

One thing I should have mentioned - I download the Evernote app from Evernote
There are reports the App Store version has issues

Share this post


Link to post
11 minutes ago, SteveJam said:

MeTheUser:  not the real one.  Just didn't want to put my name in there. 

Just to doublecheck the file name
Right Click on the folder, hold down the option key, Click on Copy xxxx as pathname

Share this post


Link to post
4 hours ago, SteveJam said:

Yes.  Did that - that's how I got the Unix path. Still getting the same error.

If you PM me the script you're running I'll check it out

Share this post


Link to post

@DTLow I just tried it and got the same error

error "Evernote got an error: File does not exist." number 3

Share this post


Link to post

@DTLow I found this script which works for me: https://gist.github.com/mshk/6276780

 

I then modified it to add a tag, and create a new Notebook in Evernote, i.e.:

 

set listOfNames to {}

set theFolder to choose folder "Select the source folder"

 

tell application "Finder"

    set filelist to every file of the folder theFolder

    repeat with currentFile in filelist

        set currentFileName to (the name of currentFile)

        set nom to currentFileName

        if text -4 of nom is "." then

            set currentFileName to (text 1 thru -5 of nom)

        end if

        set currentFileDate to (the creation date of currentFile)

        set modFileDate to (the modification date of currentFile)

        set currentFileLocation to currentFile as alias

        set currentFileFolder to (the name of theFolder)

        tell application "Evernote"

            set theItem to create note title currentFileName tags ["imported_from_Notes"] created currentFileDate notebook "Imported From Notes" from file currentFileLocation

            set (modification date of theItem) to modFileDate

        end tell

    end repeat

end tell

Share this post


Link to post
On 3/19/2017 at 3:09 PM, jd007 said:

@jd007 Thanks for the script, which worked nicely. I just made one modification: 

Quote

 

           set theItem to create note title currentFileName tags ["imported_from_Notes"] created currentFileDate notebook "Imported From Notes" from file currentFileLocation


 

set theItem to create note title currentFileName tags ["imported_from_Notes"] created currentFileDate notebook currentFileFolder from file currentFileLocation

 

This way, I was able to import my notes bh running the script for each subdirectory, where each subdirectory has notes attributed to a separate Notebook

Someone with more skills than me could probably easily modify your script to get a list of subdirectories and then execute your script for each subdirectory, making the process even easier than it was for me.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...