Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added copy_from_file and copy_from_folder functions #1398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

craigloewen-msft
Copy link

@craigloewen-msft craigloewen-msft commented Jun 17, 2024

This PR adds two functions: copy_from_file and copy_from_folder.

Goal

These functions allow users to take already existing files with full content and copy them to a new location. Some use case for this include: Maintain a record of your notes over time, Copy the latest to do list you have to a new folder so you can update its existing content easily, Copy latest status sync info, 'Template' with existing notes, Use the content you already have in an existing note and keep that up to date, copy new associated files and link to them in your templated note, and more!

Sample usage

Copy the latest modified file from one folder to another

<%* await tp.file.copy_from_folder("Status Sync", "lastModified","Status Sync") %>

Snapshot a particular file and link to it

Todo snapshot: [[<% (await tp.file.copy_from_file("Todos.md", "Snapshots", "Todo-" + tp.date.now("YYYY-MM-DD"))).basename %>]]

Improvements

This PR needs improvements for these areas. If the initial idea looks good please let me know and then I can finish coding in rest of the required items which I believe are:

  • Add documentation
  • Add test coverage
  • Would also want to add file matching (AKA use regex or wildcarding to match files with a specific pattern)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant