Skip to main content

I needed the check if a file existed in a directory as the migrate script wasn't recognising the file.  To check if a file exists:

FILE={your-directory-path}
if test -f "$FILE"; then
    echo "$FILE exists."
fi

 

If your directory path is /Users/{your name}/Sites/migrate/local_dest_dir/fish/../media/apple-store.png

FILE=/Users/{your name}/Sites/migrate/local_dest_dir/fish/../media/apple-store.png
if test -f "$FILE"; then
    echo "$FILE exists."
fi

Related articles

Andrew Fletcher18 Mar 2024
Resolving CVE-2022-48624 less issue
To resolve the CVE-2022-48624 vulnerability on Ubuntu using Nginx, it's crucial to understand that the issue lies within the "less" package, not Nginx itself. The vulnerability affects "less" before version 606, where close_altfile in filename.c in less omits shell_quote calls for LESSCLOSE,...