No Such File or Directory Find Command on Linux

find command in bash script resulting in No such file or directory error only for directories?

You don't need to escape DOT in shell glob as this is not regex. So use .AppleDouble instead of \.AppleDouble:

find $DIRTY_DIR -name .AppleDouble -exec rm -rf '{}' \;

PS: I don't see anywhere $COUNTER being incremented in your script.

find' command giving : No such file or directory error in shell script

    echo $("find $PATH -type f -size +1M")

This attempts to run a command called: find $PATH -type f -size +1M (with the $PATH expanded). As there is no such command you get the error.

Your quotes should be outside the $(...)

    echo "$(find $PATH -type f -size +1M)"

Better still, drop the echo as it is not required:

    find $PATH -type f -size +1M

As @alexcs notes, you shouldn't use PATH as a variable name because it is already used by the system (in fact you shouldn't use any all-caps variable name) and you should quote its use as the user may have provided something containing whitespace:

    read -p  "Enter the path for log files: " LogPath
# ...
find "$LogPath" -type f -size +1M

Consider:

echo $("echo '1..4..7'; echo 'a  b  c'")

"echo '1..4..7'; echo 'a b c'"

echo $(echo '1..4..7'; echo 'a b c')

echo "$(echo '1..4..7'; echo 'a b c')"

echo '1..4..7'; echo 'a b c'

Bash find- is showing the files but returning no such file or directory

The -exec foo part means run the command foo for each path found.
In your case, -exec PATH={}, the {} part is replaced with the path name, ending up with something like -exec PATH=/media/pi/88DC-E668/MP3/Dance.mp3, and so then find tries to run the command PATH=/media/pi/88DC-E668/MP3/Dance.mp3 which fails because there isn't actually any such program to execute.

xargs is the usual way to do what you're trying to do, as described in another comment already.
You could also do:

find /media/pi/88DC-E668/MP3/ -name \*.mp3 |
while read f; do
omxplayer "$f"
done

No such file or directory when using find with -exec option

Find is trying to enter the directory after it has been deleted. If you add the -depth option to your command line, find will run in depth-first mode in which it will attempt to process the contents of the directory before deleting it:

find /home/pi/testing -depth -type d -exec rm -rf {} \;

That said, your find command line isn't very useful: for this operation, you would generally just run rm -rf /home/pi/testing.

No such file or directory but it exists

This error can mean that ./arm-mingw32ce-g++ doesn't exist (but it does), or that it exists and is a dynamically linked executable recognized by the kernel but whose dynamic loader is not available. You can see what dynamic loader is required by running ldd /arm-mingw32ce-g++; anything marked not found is the dynamic loader or a library that you need to install.

If you're trying to run a 32-bit binary on an amd64 installation:

  • Up to Ubuntu 11.04, install the package ia32-libs.
  • On Ubuntu 11.10, install ia32-libs-multiarch.
  • Starting with 12.04, install ia32-libs-multiarch, or select a reasonable set of :i386 packages in addition to the :amd64 packages.

find exec ls : No such file or directory

The arguments of -exec should not be quoted. Remove the quotes after -exec. And -exec does not detect aliases so you need to pass the --color option to exec.



Related Topics



Leave a reply



Submit