How to? Name completion only of directories?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
May 20, 2009
216
0
53
ITALY
#1
I am in a directory called for example "F:\Provider\Cisco\".
Inside it I have many files, all that start with "AnyConnect*", and also a directory called "anyconnect-win-3.1.10010-pre-deploy-k9", as You can see below there are many files.
Now, I want for example to see what is inside the directory.
I type "dir anyconnect" and then press TAB.
I have to press it many times, since it finds first all files, and only at the end it finds the directory.
Is there a way, for example with ctrl+alt+shift+tab, or an option, to expand names only for directories and not for files?
Right now I cannot find any.
I can use a workaround, for example I cd into the directory and then I type dir.
Or, I type "cd anyconnect" and then press TAB.
Since I have the option that for cd it completes only directories, I get immediately the directory and skip files.
Then, I go back on the command-line and change from cd to the command that I want to use.
But, I would like better a key combination to expand only directories.


Thank You and regards

Rodolfo Giovanninetti


Volume in drive F is unlabeled Serial number is 00bd:629b
Directory of F:\PROVIDER\cisco\*

03/09/2015 11:23 <DIR> .
03/09/2015 11:23 <DIR> ..
02/09/2015 15:42 <DIR> anyconnect-win-3.1.10010-pre-deploy-k9
02/09/2015 16:39 247.696 anyconnect-EnableFIPS-win-3.1.10010.exe
02/09/2015 16:39 10.240 anyconnect-EnableFIPS-win-3.1.10010.mst
02/09/2015 16:39 581.000 anyconnect-gina-win-3.1.10010-pre-deploy-k9-lang.zip
02/09/2015 16:39 581.003 anyconnect-gina-win-3.1.10010-web-deploy-k9-lang.zip
02/09/2015 16:39 85.426 anyconnect-linux-3.1.10010-EnableFIPS.tar.gz
02/09/2015 16:38 12.122.817 anyconnect-linux-3.1.10010-k9.pkg
02/09/2015 16:38 7.232.810 anyconnect-linux-3.1.10010-vpnapi.tar.gz
02/09/2015 16:38 82.983 anyconnect-linux-64-3.1.10010-EnableFIPS.tar.gz
02/09/2015 16:38 12.718.496 anyconnect-linux-64-3.1.10010-k9.pkg
02/09/2015 16:38 7.531.051 anyconnect-linux-64-3.1.10010-vpnapi.tar.gz
02/09/2015 16:37 79.863 anyconnect-macosx-i386-3.1.10010-EnableFIPS.tar.gz
02/09/2015 16:37 9.573.720 anyconnect-macosx-i386-3.1.10010-k9.dmg
02/09/2015 16:37 12.722.977 anyconnect-macosx-i386-3.1.10010-k9.pkg
02/09/2015 16:37 6.463.026 anyconnect-macosx-i386-3.1.10010-vpnapi.tar.gz
02/09/2015 16:37 9.051.855 anyconnect-predeploy-linux-3.1.10010-k9.tar.gz
02/09/2015 16:37 9.605.229 anyconnect-predeploy-linux-64-3.1.10010-k9.tar.gz
02/09/2015 16:36 4.120.576 anyconnect-profileeditor-win-3.1.10010-k9.msi
20/06/2013 12:08 1.868.864 anyconnect-win-2.5.3046-web-deploy-k9.exe
02/09/2015 16:36 38.409.858 anyconnect-win-3.1.10010-k9.pkg
02/09/2015 16:35 585.681 anyconnect-win-3.1.10010-pre-deploy-k9-lang.zip
02/09/2015 16:35 23.244.800 anyconnect-win-3.1.10010-pre-deploy-k9.iso
02/09/2015 16:34 585.661 anyconnect-win-3.1.10010-web-deploy-k9-lang.zip
02/09/2015 16:34 75.264.810 anyconnect-win-vpnapi-3.1.10010.zip
02/09/2015 16:33 814.121 sampleTransforms-3.1.10010.zip
02/09/2015 16:33 47.130 thirdparty_3.1.10010_3eTI_Docs.zip
233.631.693 bytes in 25 files and 3 dirs 233.672.704 bytes allocated
3.262.488.576 bytes free
 
Jun 2, 2008
284
1
Newton, MA
#2
You could define an alias, for example DIRD, that runs the DIR command, but you could configure it the way you did CD to file-complete only directories.

-- Jay
 

samintz

Scott Mintz
May 20, 2008
1,203
11
Solon, OH, USA
#3
Yes, what Jay said. Add DIRD to your FILECOMPLETION environment variable (e.g. set FILECOMPLETION=cd cdd rd dird:DIRS) or in your configuration file. And add a DIRD alias. Or if you are a lazy typist like me, name it DD instead of DIRD.

Code:
set FILECOMPLETION=cd cdd rd dd:DIRS
alias dd=dir

DIR<tab> will cycle through all the names
DD<tab> will only cycle through the directory names
 
Jun 2, 2008
284
1
Newton, MA
#4
Scott, I used DIRD in the example because, like you, I'm a lazy typist, which means that I already had an alias DD that does something that I need a lot more often that what was asked for here. And then, of course, there's the alias D, which is what I use for the DIR command with my favorite options.:smile: