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 8480469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:18:10+00:00 2026-06-10T19:18:10+00:00

I am trying to a) count how many files I have on my mass

  • 0

I am trying to a) count how many files I have on my mass filer EMC device, b) load them in an array c) display a count of how many files I have d) bulk load each file in my database e) display the name of the file I just loaded.

This is my code…

export OUT=/path/to/device
P_Array=$(cd ${OUT} ; find . -name "*TXT" | wc -l)
Plen=${#P_Array[@]}
echo "$Plen FILES TO PROCESS."                                       
if [ $Plen -eq 0 ]
then
        echo "`date '+%m/%d/%y %T:'` ZERO FILES."                  
fi

for name in ${P_Array[@]}
do
        ###Database Bulk Load Here###
        echo "`date '+%m/%d/%y %T:'` $name was loaded."
done

Problem A: Plen=${#P_Array[@]} displays a count of 1 when it should be 5 (sandbox env, right now).
Problem B: $name display the total number of files instead of the individual file name.

Obviously, this is all wrong. I am sure I have something switched around but I am not sure what it is. Help!

  • 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-10T19:18:12+00:00Added an answer on June 10, 2026 at 7:18 pm

    Since you do wc -l on the result of find it’s going to give the number of files. Hence, the P_Array contains only one number. So Plen is just 1.

    Change them to:

    P_Array=$(cd ${OUT} ; find . -name "*TXT")
    Plen=$(cd ${OUT} ; find . -name "*TXT" | wc -l)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a script to pull the word count of many files
Trying to count how many elements within the array are not equal to 0,
im very new to python, Im trying to count how many x I have
I'm trying to count how many distinct value of FLOOR there is but I
I'm trying to count how many times a user has copied something from my
I'm trying to count the number of records that have a null DateTime value.
I'm trying to count all the values inside an array, I've tried using count()
I'm new to Hadoop. Recently I'm trying to process (only read) many small files
I am trying to figure out how to display a count for records that
I am trying to load all the .png files from an internal application folder

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.