Skip to content

Instantly share code, notes, and snippets.

@doc22940
Forked from simonbs/Append to File.js
Created April 18, 2020 10:52
Show Gist options
  • Select an option

  • Save doc22940/c74be02ba12c070e516ac966efbd661e to your computer and use it in GitHub Desktop.

Select an option

Save doc22940/c74be02ba12c070e516ac966efbd661e to your computer and use it in GitHub Desktop.
Appends text to a file. To be used with Shortcuts.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-blue; icon-glyph: file-signature;
let text = args.shortcutParameter
let fm = FileManager.iCloud()
let filePath = args.fileURLs[0]
let content = fm.readString(filePath)
let newText = content + "\n" + text
fm.writeString(filePath, newText)
Script.complete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment