In terminal is there a way for Terminal to guess a file based on an incomplete file path? For example:
Instead of /Users/me/foo1/foo2/foo3/foo4/TargetFile
, is there a way to just do /foo3/foo4/TargetFile
?
I want to be able to access the file no matter where it is. Thanks.
Use incomplete file path in terminal
command linepathterminal
Related Question
- How to add the Applications folder to the terminal PATH
- Access path of open file
- Checking path capitalization of pwd
- How to make “Go to Folder” show current path
- How display file path at bottom in “All My Files” on Sierra 10.12.3
- Get/Copy current Excel file’s path
- Force terminal to use binary from a different path
- Finder does not open URL to file path
Best Answer
If the file's path is relative to the current working directory your could use:
You could wrap this in a shell function:
In
zsh
you can use the globstar feature:In ksh:
In bash4: