Results 1 to 3 of 3

Thread: How to detect the number of files stored in Linux directory

  1. #1
    Join Date
    Apr 2009
    Posts
    107

    How to detect the number of files stored in Linux directory

    I'm trying to get a total count of my WMV files from My Music and all its sub directories. Here is the directory structure.

    My Music
    |_> Artist
    | |_> Album1
    | | |__> songname1.mp3
    | |_|__> songname2.mp3
    | |_> Album2
    | |_|__> songname1.mp3
    | |_|__> songname2.mp3

    I seem to remember learning that windows can only have so many objects (files and dirs) within one directory. Is the same true for Linux, or is the number of files able to be held in a directory only limited by hd space?

  2. #2
    Join Date
    Mar 2008
    Posts
    349

    Re: How to detect the number of files stored in Linux directory

    find . -name '.svn' -type d | xargs rm -rf
    If you wanted to search for number of files in Linux then this searches for all directories which have svn related files. This is a useful command, but might not work as expected if there are hundreds of thousands files on the server. In this case the following command may be useful:

    1. find . -name .svn -prune -exec rm -rf {} \;

  3. #3
    Join Date
    Feb 2006
    Posts
    172

    Re: How to detect the number of files stored in Linux directory

    Depends on which file system you're using. Hope you might be aware of regular expression then use it with grep,The max number of files per dir is theoretically unlimited (actually around 130 trillion), but performance becomes terrible with above 10-15 thousand files.

    Code:
    ls -1R | grep .*.mp3 | wc -l
    The max number of files per directory is theoretically unlimited (actually around 130 trillion), but performance becomes terrible with above 10-15 thousand files.

Similar Threads

  1. Where APK files are stored on Android?
    By GPower in forum Portable Devices
    Replies: 5
    Last Post: 01-12-2011, 02:16 PM
  2. Why my ISO files are not stored in the root directory ?
    By Dimensioner in forum Windows Software
    Replies: 3
    Last Post: 25-02-2011, 09:06 AM
  3. Number stored as text in vlookup
    By Alexander102 in forum Windows Software
    Replies: 3
    Last Post: 09-06-2009, 09:00 AM
  4. Replies: 2
    Last Post: 31-01-2009, 01:12 PM
  5. Replies: 6
    Last Post: 13-09-2008, 02:15 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,636,840.43085 seconds with 17 queries