Removing Synology @eaDir files
Synology NAS has a very annoying indexing service implementation that places indexed files’ thumbnails alongside your actual media files.
The thumbnail photos and videos reside in @eaDir
directories in every single media directory you have, nested as deep as your directory structure goes.
So if you will ever want to move out your data elsewhere outside from your NAS, there are high chances that you will be moving the @eaDir
together with your media.
Delete it safely with the following bash command before you move your data. It will also print their names as they are being deleted (to see the progress):
find . -type d -name "@eaDir" -print -exec rm -rf "{}" \;
Explanation of the Command
Let’s break down the command for clarity:
find .
: This part tells thefind
command to start searching from the current directory.-
-type d
: This option restricts the search to directories, ensuring thatfind
only looks for directories and not individual files. -
-name "@eaDir"
: This tellsfind
to match directories that are exactly named@eaDir
. -
-print
: This option instructsfind
to print the path of each directory it finds to the standard output (your terminal or console). This happens before the-exec
command is executed, so you’ll see the name of each directory asfind
processes it. -
-exec rm -rf "{}" \;
: This part of the command is responsible for deleting the directories thatfind
locates. The explanation for this part remains the same as before:rm -rf "{}"
tellsrm
to forcefully remove the found directories and their contents. The{}
is replaced by the path of each directory found byfind
.\;
marks the end of the command to be executed for each found item. The backslash is used to escape the semicolon so that the shell interprets it as part of thefind
command rather than as a command separator.
What The Command Does
This command will search the current directory and all subdirectories for directories named @eaDir
. For each directory found, it will:
- Print the path of the directory to the terminal, allowing you to see which directories are being processed.
- Execute the
rm -rf
command to delete the directory and all its contents.
This approach is useful when you want to keep track of the progress of the deletion process, especially if dealing with a large number of directories or a directory structure with deep nesting. It provides visual feedback in the terminal, showing you exactly what’s being deleted in real-time.
Caveats
When running the command find . -type d -name "@eaDir" -print -exec rm -rf "{}" \;
, encountering errors such as “No such file or directory” is normal and typically not cause for concern.
These errors occur because find
attempts to access directories it had planned to search or act upon, but those directories have already been deleted by the command itself during its execution. Essentially, find
notes down paths to visit and actions to perform at the start, and if those paths are altered (e.g., directories are removed) while it’s still running, it might try to access something that no longer exists. This behavior is a byproduct of how find
traverses and modifies the directory tree in real-time, and since the primary goal of deleting the specified directories is achieved, these error messages can safely be ignored. They simply indicate that find
is doing its job and the directories are indeed being removed as intended.
Recent Comments