Find returns : No such file or directory ?


Results 1 to 5 of 5

Thread: Find returns : No such file or directory ?

  1. #1
    Join Date
    Mar 2015
    Posts
    10

    Find returns : No such file or directory ?

    I've written a short script to traverse a directory tree and count the number of occurrences of a specific file type. Script as follows:
    Code:
    #!/bin/bash
    find -type d | while read dir; do
        count=$(find "$dir" -iname \*.cue | wc -l)
        echo "$dir	$count"
    done
    When run find chokes on certain folder names e.g.:
    Code:
    find: ‘./G/Genesis - Abacab [1993 24k Gold Original Master Edition]’: No such file or directory
    I recall coming across and solving this many years back, but the answer escapes me now. Any help/ insights appreciated.
    Last edited by archuser; 05-16-2016 at 02:52 AM.

  2. #2
    Join Date
    Oct 2002
    Location
    AZ, USA
    Posts
    110
    How about trying
    Code:
    find -type d -print0 | ...
    or
    Code:
    find -type d -ls | ...
    see UNUSUAL FILENAMES section of the man page.

  3. #3
    Join Date
    Mar 2015
    Posts
    10
    Thx, tried both, neither worked. -print0 returns nothing. -ls returns every line as : No such file or directory.

  4. #4
    Join Date
    Oct 2002
    Location
    AZ, USA
    Posts
    110
    The gist of the matter is that you need to either quote the Directory names on escape the whitespace in them.
    for me the -ls does escape the whitespace, but it is otherwise the same as doing a "ls -l ".

    I saw some suggestions to use -xargs

    but this one might be what you are looking for;
    http://unix.stackexchange.com/questi...s-in-the-names

  5. #5
    Join Date
    Jun 2016
    Posts
    1
    Awesome!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •