|
Hey, awesome application! Keep up the good work! I want to find all - name: "Git repos"
targets: dirs
subfolders: true
locations:
- path: "~"
system_exclude_dirs: []
min_depth: 1
max_depth: 1
filters:
- regex: "^.git$"
actions:
- move: "{env.GIT}/{relative_path.parent}"It finds the |
Replies: 1 comment 3 replies
|
@j-lakeman -- you're thinking about this a little wrong. Let's say What you want is to move Instead, you want a rule that will match - name: "Git repos"
targets: dirs
subfolders: true
locations:
# Look at all directories in ~
- path: "~"
system_exclude_dirs: []
min_depth: 0
max_depth: 0
filters:
# Match only if the directory has a .git subdirectory
- python: |
git_repo_path = path / ".git"
return git_repo_path.is_dir()
actions:
# Move ~/x to ${GIT}/x
- move: "{env.GIT}"I think this is what you're trying to do. Hopefully this is still useful! P.S. If you were actually trying to match the |
@j-lakeman -- you're thinking about this a little wrong. Let's say
GIT=~/my_git_projectsand you have this folder structure:What you want is to move
my_projectandanother_projectinto~/my_git_projects. (Right?) But your rule is matchingmy_project/.gitandanother_project/.git, and then doing amoveaction on those subdirectories.Instead, you want a rule that will match
~/my_projectand~/another_project, but not~/other_dir, because it doesn't have a.gitsubdirectory. There is no filter that means "match directory if it has a file or subdirectory named X," so you'll need apythonf…