Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:45:26+00:00 2026-06-01T20:45:26+00:00

I am saving on a daily basis a number of files into a specific

  • 0

I am saving on a daily basis a number of files into a specific folder (xls). Is there a way that I could have powershell gather each file into a different variable (it could be 2 files, it could be 5) and then see if there are more than 2 lines of text in each file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:45:28+00:00Added an answer on June 1, 2026 at 8:45 pm

    I don’t think you need to gather them into a variable necessarily, depending on what you wanted to do once you found the files.

    Basic example:
    If I have 3 text files created named Test1.txt, Test2.txt, Test3.txt. With just basic “line x” to depict the line number. Contents of one say Test1.txt is

    
    Line 1
    Line 2
    Line 3
    

    Test2.txt stops at “Line 2”, and then Test3.txt just has “Line 1”.
    A one liner solution that would work in this instance, that will just output the name with greater than 2 lines:

    
    dir *.txt | foreach {if ((Get-Content $_).Count -gt 2) {$_.Name}
    

    Output from this code gives me Test1.txt.

    In your situation you could just do the dir command for “*.xls” or whatever file extension you are using.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm saving a struct into a .dat file. Lets suppose I have to edit
When saving something to a text file is there a way to not override
After saving a String value into memcached using the Danga client, I attempted to
When saving a new entity something strange happens... I have a data grid with
I know the standard Major.Minor.Build.Revision but there's several considerations for us that are somewhat
The higher-ups in my company were told by good friends that flat files are
I'm having trouble saving an entity into an SQL Server 2005 database. I'm using
While saving a collection with all the changes, how can i ensure that blank
When saving a record with belongs to is it possible to ensure that the
while saving an entity that has reference properties, is it the app's responsibility to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.