I have a folder with some dotfiles I would like to make symlinks for. I cannot see an easy way to do this.
ls -a ~/dotfiles
will include the dotfiles, but also .
and ..
find ~/dotfiles -maxdepth 1
will include the dotfiles, but also ~/dotfiles
Based off MvanGeest’s comment this appears to work.
find ~/dotfiles -maxdepth 1 -mindepth 1
This looks to do the job as well
ls -A ~/dotfiles
Looks like you're trying to find dot files, ie. Files that start with a "." and have a second character that is not a ".". This should do the job:
find . -name '.[^.]*'
to link all found files to /path/to/dir:
find $PWD -name '.[^.]*' -exec ln -s '{}' /path/to/dir \;
Note that "$PWD" produces an absolute path, as symlinks to relative paths will most likely point into nirvana...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With