I have a file structure like so
/foo/bar/
├── .foo.cfg
├── foo.cfg
├── foo.data
├── foo.py
├── .svn
│ ├── ...
│ ├── ...
│ └── ...
├── .
└── ..
I want to open all of the hidden and non hidden files into vim. I could do it manually like so
vi .foo.cfg foo.cfg foo.data foo.py
but that doesn't work when there are 100+ files. I have also tried the following with no success
#hidden files not loaded
vi *
#Includes folders and '.' and '..'
vi * .*
#loads files one at a time
for i in `ls -a` ; do vi $i; done;
#loads files one at a time
find . -name "*" -type f -maxdepth 1 -exec vi {} ";"
The following should work:
find . -maxdepth 1 -type f -exec vi {} +
From the find
man page:
-exec command {} +
This variant of the -exec option runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. The command line is built in much the same way that xargs builds its command lines. Only one instance of ’{}’ is allowed within the command. The command is executed in the starting directory.
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