DIR Command in Windows Command Line [closed] - windows

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
How do I use the DIR command to list all directories, including subdirectories, that contain no files? I've researched this at length and can only find how to DELETE the specified directories, but not actually list them. Can anyone help? Is there a better way other than the DIR command?

You could modify the Powerscript answer on the linked question to display instead of delete like this:
Get-ChildItem -Recurse . | where { $_.PSISContainer -and #( $_ | Get-ChildItem ).Count -eq 0 } | Select-Object -Property FullName

Related

Why doesn't "ls -ad */" show both hidden and non-hidden directories? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last year.
Improve this question
Why doesn't the command:
ls -ad /*
...show both hidden and non-hidden directories? And given this does not work, what would be the simplest command for showing hidden and non-hidden directories, without showing files?
Thanks!
/* is expanded by the shell before ls ever runs. The expansion only includes non-hidden files unless the dotglob option is set. Also, if you want the expansion limited to directories, use /*/ instead.

ag and rg not listing files starting with underline, find does [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
If I do:
touch _gandalf
And then:
rg --files | grep gandalf | wc -l
or
ag -l -g "" | grep gandalf | wc -l
I get 0 matches as result.
Now if I do a touch gandaf I get 1 match.
Why is that? Does files starting with underline have a similar behaviour as hidden files? Maybe is something on mac's filesystem? As mentioned on the title if I replace ag/rg for find . it works as expected.
In my case was my global .gitignore having a clausule to exclude files starting with underlines.
But I think is useful to keep in all this files (as mentioned on the comments):
.gitignore
.ignore
.rgignore
.agignore

Unix command equivalent in Windows Powershell [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
what is the equivalent of command ls -la in Windows Powershell?
Get-ChildItem -Force will reveal hidden items, but the format of -la isn't directly mirror-able in powershell though as it returns objects rather than a string, use Select x,y,z to get the details you're looking for.
Not in correct order for the -l-switch, but this will get you started:
ls -force|Select-Object attributes, fullname, length, LastAccessTime, LastWriteTime, CreationTime, #{N='Owner';E={$_.GetAccessControl().Owner}}|Format-Table
To see which properties are available for select-object you can use the following:
Get-ChildItem -force|Get-Member -MemberType Properties
And as stated by Clijsters in the comments: If you are using linux, ls might not be an valid Powershell alias, so use Get-ChildItem or gci.

how to grep only current directory for specific files [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
Hello I have a question I want to find a keyword in a directory without recursion. And I want to check only for the .c extensions.
For example I try;
grep -r 'keyword' --include=*.c .
And it works. But I dont want recursive search I just want the current directory's results so I remove the -r
grep 'keyword' --include=*.c .
However this gives me an error that ". is a directory". Actually I have an idea to write the contents of recursive grep to a textfile and grep that textfile for the file extensions but I think it wont be efficient at all. Thanks for your support.
I suggest this:
grep 'keyword' *.c
The other answer is clean and efficient.
But I have the feeling that you insist on using "-r" and/or "--include", maybe for reasons not mentioned.
bash-3.1$ grep -r --include="*.c" -dskip 'keyword' ./*
Closer to your original syntax, you can use:
grep --include=*.c 'keyword' *
This reports directories without searching them.

get folder address from text file for copy file ( by command ) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm tray to save (folder address) to a text file and i want copy file to this address ,
is there any way to use copy command read this text address and copy file to the address
i want make a copy batch program for copy my file to several address in my pc but get the address from a text file , Addresses are not fixed and often change.
Like this ?
get-content text_path.txt | foreach { copy file.txt -dest $_ }
It's not quite clear, what your problem is, but this may help you:
to write something to a file use
echo this is my text>file.txt
to read it back into a variable use
set /p "var="<file.txt
Then you can use it:
echo I have read: %var%
Note: this is the simplest way to do it, but it works only with "one-line-files" - exactly, what you need (according to your description)

Resources