Re: How to find total MB of a directory plus all subdirectories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 11 March 2007 22:06, Les wrote:

> > > Hi, Nigel,
> > >  The reason a command won't parse correctly with a space in the file
> > > name is due to the tokenizer used by the shell.  It cannot deal with
> > > spaces in filenames.  A space is the end of the word to the tokenizer
> > > unless it is inside Quotes or escaped in some way.  Thus the command du
> > > xxx yyy is going to look for files xxx and then yyyy.  This is true of
> > > most systems.  otherwise there would be no way to chose which way to
> > > parse a command with several arguments, for example:
> > >  cat xxx yyy aaa bbb ccc ddd > temp.txt
> > >
> > >  In this case should the result consist of files xxx, yyy, zzz, bbb,
> > > ccc, and ddd all being concatenated to a file called temp.txt, or
> > > should it be xxx yyy, zzz bbb, and ccc ddd?  Moreover how would an
> > > unambiguous error message tell the operator what was wrong?  What if
> > > files xxx, yyy zzz, bbb zzz, and ddd were all present?  Is this what
> > > the operator meant?
> > >  This is why a good administrator doesn't put spaces in system control
> > > files.  It leads to ambigousity when working on the system, leading to
> > > errors and system corruption.  Typo's that would be caught might not be
> > > if spaces are allowed into filenames.
> > >
> > >  On the other hand, once a directory is opened, the file names are read
> > > via a special command designed for the OS, and if the OS permits
> > > spaces, the entire file name up to the end charactor (generally
> > > control-Z or NULL).  Thus the sub directories and files will be
> > > correctly handled. But with spaces in the names, error messages
> > > regarding parsing, or tracing the file contents may be ambiguous to the
> > > operator.  It is not illegal to put spaces in filenames, but is should
> > > be considered a bad practice, and avoided.  But it is your system, so
> > > YMMV.
> > >
> > > Regards,
> > > Les H
> >
> > Thanks Les for that very thorough explanation. I will be more carefull
> > about spaces in the future.
> >
> > A related question, is. How do I find out how many files are in the
> > Sounds-Library directory, including all subdirectories. I looked at ls,
> > but that will only give a list of files, as far as I can see.
> >
> > Thanks.
> >
> > Nigel.
>
> try ls -a or ls -al
>
>    man on ls will give you some options to try.  The best way to get at
> the commands is through man or Xman (an old utility that would list the
> man pages available by category).
>
> Regards,
> Les H

Hi Les. You may have missed the reply to you that I sent to the list.

I posted also to the KDE list to see if Konqueror's file manager would show 
file numbers including all files in subdirectories. The answer was yes, but 
in my FC2 with an older version of KDE this is not displayed, but in FC5, if 
you right click on for example my Sounds-Library directory, and go to 
properties, it does show a total for all files in the directory, including 
files in subdirectories. With my Sounds-Library that amounts to 17480 files.

Kevin Krammer at KDE also gave a CLI solution as below, and that works also.

$ find /path/to/folder -type f | wc -l

I did try ls -a, and ls -al, but both just give a subdirectory list, one with 
a bit more info than the other.

Thanks for the reply.

Nigel.


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux