NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Q:
https://razlozhi-pasyans.online/

Powershell script to return list of all files containing a specific string?

What is the simplest way to get a list of all files in a directory containing a specific string?
Example: I have a directory (in a Git repo) that contains files of the form
a.txt
b.txt
hello.txt
c.xml
Doe John

I want to run a Powershell script that returns the names of all files in this directory containing the string "Doe".

A:

DirectoryInfo dir = new DirectoryInfo(path);
DirectoryInfo[] subDirs = dir.GetDirectories("*", SearchOption.AllDirectories);
var files = subDirs.Where(x=>x.Name.EndsWith(".txt"));

Edit: after discussion of your comments below I have updated the code. I've also added a proper error-handling statement (option Set-StrictMode -Version 2) to the script. To use it you'll have to add a reference to the Microsoft Scripting Runtime library and set the current directory.

A:

If you're using Windows PowerShell:
dir |? $_.Name -match 'John'

People's Platform

The People’s Platform was a political initiative of The People's Movement for Socialism (MAS) intended to be the programmatic programme of the MAS for the 2007 Venezuelan National Assembly election.

According to the Marea Socialista website, the programme's objective was "to form the basis of a democratic government for Venezuela". The objective of this program was listed as the promotion of socialist policies.

The program was released on May 28, 2007.

The platform is divided into five parts: the first is called “This is the Truth”; the second is called “This is the Way”; the third is called “This is the Goal”; the fourth is called “This is Our Life”; and the last is called “This is the Spirit”.

References


Category:Political party programmes
Category:2007 documents
Category:2007 in Venezuela
Category:2007 in politicsThe "Game of Thrones" cast had a massive conga
Here's my website: https://razlozhi-pasyans.online/
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.