<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Count total file command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635766#M42373</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;To find the total number of files in your current directory and subdirectories, execute:&lt;BR /&gt;&lt;BR /&gt;# find . -type f -print | wc -l&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong&lt;BR /&gt;Brainbench MVP for Unix Admin&lt;BR /&gt;&lt;A href="http://www.brainbench.com" target="_blank"&gt;http://www.brainbench.com&lt;/A&gt;</description>
    <pubDate>Thu, 27 Dec 2001 05:46:42 GMT</pubDate>
    <dc:creator>Steven Sim Kok Leong</dc:creator>
    <dc:date>2001-12-27T05:46:42Z</dc:date>
    <item>
      <title>Count total file command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635765#M42372</link>
      <description>How could I count the total of files in my directory. There are many subdirectory in my directory. Thanks in advance.</description>
      <pubDate>Thu, 27 Dec 2001 05:37:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635765#M42372</guid>
      <dc:creator>Kenn Chen</dc:creator>
      <dc:date>2001-12-27T05:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Count total file command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635766#M42373</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;To find the total number of files in your current directory and subdirectories, execute:&lt;BR /&gt;&lt;BR /&gt;# find . -type f -print | wc -l&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong&lt;BR /&gt;Brainbench MVP for Unix Admin&lt;BR /&gt;&lt;A href="http://www.brainbench.com" target="_blank"&gt;http://www.brainbench.com&lt;/A&gt;</description>
      <pubDate>Thu, 27 Dec 2001 05:46:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635766#M42373</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2001-12-27T05:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Count total file command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635767#M42374</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;# find dir_path -depth -type f -print | wc -l&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Shiju</description>
      <pubDate>Thu, 27 Dec 2001 05:56:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635767#M42374</guid>
      <dc:creator>Helen French</dc:creator>
      <dc:date>2001-12-27T05:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count total file command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635768#M42375</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;To count files in your current directory only:&lt;BR /&gt;&lt;BR /&gt;ll -a | grep ^- | wc -l&lt;BR /&gt;&lt;BR /&gt;The ^ says to match lines beginning with the next character.  You can change ^-&lt;BR /&gt;using the character from "man ls" shown below to count specific types of directory entries:&lt;BR /&gt;&lt;BR /&gt;The first character indicates the entry type:&lt;BR /&gt;&lt;BR /&gt;b    Block special file&lt;BR /&gt;c    Character special file&lt;BR /&gt;d    Directory&lt;BR /&gt;l    Symbolic link&lt;BR /&gt;n    Network special file&lt;BR /&gt;p    Fifo (also called a "named pipe") special file&lt;BR /&gt;s    Socket&lt;BR /&gt;-    Ordinary file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can count multiple types using the format:&lt;BR /&gt;&lt;BR /&gt;ll -a | egrep '^d|^-' | wc -l&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;To include sub-directories:&lt;BR /&gt;&lt;BR /&gt;ll -aR | egrep '^-' | wc -l&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Thu, 27 Dec 2001 13:33:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635768#M42375</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2001-12-27T13:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Count total file command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635769#M42376</link>
      <description>My personal favorite for counting the number of files in a single directory is:&lt;BR /&gt;&lt;BR /&gt;$ ls -1 | wc -l&lt;BR /&gt;&lt;BR /&gt;The -1 (thats the number one) causes ls to print one file name per line.  Its a lot quicker than running ll because ls doesn't have to stat each file so its useful when you have a huge number of files in a directory.&lt;BR /&gt;&lt;BR /&gt;Of course, if you want to include sub-directories as well the find command as already suggested is the way to go.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 28 Dec 2001 12:54:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635769#M42376</guid>
      <dc:creator>Steven Gillard_2</dc:creator>
      <dc:date>2001-12-28T12:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count total file command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635770#M42377</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Just a word of clarification - if you are piping the output of "ls", then you don't need to use the -1 switch.  If the command is not outputting to a login device, e.g. a pipe, then it *defaults* to one entry per line.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Fri, 28 Dec 2001 13:24:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/count-total-file-command/m-p/2635770#M42377</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-12-28T13:24:51Z</dc:date>
    </item>
  </channel>
</rss>

