Find the answer to your Linux question:
Results 1 to 4 of 4
I have an extremely weird issue that I cannot seem to figure out for the life of me. I am attempting to search a drive for all files with a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2013
    Posts
    2

    "Find" problem in Bash Script


    I have an extremely weird issue that I cannot seem to figure out for the life of me. I am attempting to search a drive for all files with a *.mkv extension. Here is the command:

    Code:
    find "/Volumes/External" -name '*.mkv'
    This works for about 80% of the directories on this drive, however a few of them give me an error: "Find: /Volumes/External/FolderC/FolderS: No such file or directory". This is strange because it can identify these folders to tell me they don't exist. I can specify the find command to look at the direct path of the directories that "don't exist", and it works perfectly fine.

    Finally, the weirdest part of this whole thing is that it is somehow related to the alphabetical name of the directory. For instance, if I rename "FolderS" to "FolderR" it works perfectly fine. If I rename it to "FolderT", however, I get the same issue. Anything after "S" doesn't seem to work. I have spent hours trying to figure this out and it's driving me mad. Anyone have an idea?

    Also, all permissions are the same on everything, so I don't believe that's related.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,530
    If the directories are soft links, you need to add the option -L to follow them, otherwise you may run into this problem. IE:
    Code:
    find -L dirname -type f -name '*.mkv'
    Looking further into your problem as described, the only thing else I can think of is that there is some naming issue with your directories, such as hidden characters that cannot be handled by the find command. That said, I have not run into this except in the soft link issue as described.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2013
    Posts
    2
    That worked! Thank you so much. I have no idea why those directories would be symbolic links or why the name of them mattered, but adding the -L at least makes the script work.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,530
    Glad to help! You could mark the thread as "Solved" now I think...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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