question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maintaining subfolder tree on move action?

See original GitHub issue

Can’t seem to figure this one out.

Given a folder structure: ~/Downloads/SomeFontPackage/SomeFolder/font.ttf

I can’t figure out how to do a Move with a ttf extension that will let me move to say: ~/Downloads/FONTS/SomeFontPackage/SomeFolder/font.ttf (the goal being maintaining the folder structure)

I tried messing with the paths, including trying the {path.relative_to('~/Downloads)}, following the PurePath documentation, but I get:

File lily_of_the_valley/Lily of the Valley.ttf:
    - [Move] ERROR! Missing template variable 'PosixPath' object has no attribute 'relative_to('/Users/MYUSER/Downloads')' for "~/Downloads/FONTS/{path.relative_to('/Users/MYUSER/Downloads')}/"

I know you can chain paths and parents, but it seems like a guessing game of “how many parents might an item have.”

FWIW my Python(s) are installed via brew on macOS High Sierra:

12:00 $ which python
/usr/bin/python
✔ ~/Downloads
12:04 $ which python3
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3

I’m sure I’m missing something simple. Thanks for your hard work on this! I want to get it going and then just cron it (or equivalent). 😄

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rtgoodwincommented, Jul 7, 2018

Test successful!

Made a new empty TESTFOLDER dir, with new FONTS dir inside. Copied the Backspacer... folder into TESTFOLDER/, and ran organize sim:

22:43 $ organize sim
SIMULATION ~~~
Folder ~/Downloads/TESTFOLDER/*[!FONTS]/**/*.ttf:
  File backspacer_tribute_to_pearl_jam/Backspacer tribute to Pearl Jam.ttf:
    - [Move] Move to "/Users/XXXXX/Downloads/TESTFOLDER/FONTS/backspacer_tribute_to_pearl_jam/Backspacer tribute to Pearl Jam.ttf"
1reaction
tfeldmanncommented, Jul 6, 2018

This bugged me a lot so I just uploaded a new version of organize. Please update with pip3 install -U organize-tool and try it out:

rules:
  - folders:
      - '~/Downloads/*[!FONTS]/**/*.ttf'
    actions:
      - Move: '{basedir}/FONTS/{relative_path}'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Move file and directory into a sub-directory along with commit ...
In stead of using an inefficient --tree-filter I move the files directly on the index With an --index-filter . git filter-branch -f --index- ......
Read more >
PowerShell Move-Item examples for file, folder management
You can move files, while maintaining the folder structure, ... The following command puts the files into a subdirectory called Target:
Read more >
Find Files Faster: How to Organize Files and Folders - Zapier
"To review" and "from review" subfolders. This strategy starts with the same top-level folders as the example above, but instead focuses on ...
Read more >
Git: move files in an subfolder keeping history - gists · GitHub
Change structure of project folder with Git. I have this structure: project-folder/ .git wp-admin/ wp-content/ wp-includes/ .htaccess .
Read more >
How to move a file recursively based on size and keep structure
The easy way is with zsh. You can use glob qualifiers to match files according to criteria such as their type and size....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found