I have gone through quite a few threads on AskUbuntu and elsewhere but as it sounds, all of them are about deleting hidden files, while I'm trying to:
delete non-hidden files, from a non-hidden directory, which is inside a hidden directory.
I like to delete all files inside /home/admn/.cache/thumbnails/normal/
directory using a Bash script.
The simple script that I have created:
sudo nano /usr/local/scripts/test.sh
#!/bin/bash
shopt -s dotglob
rm '/home/admn/.cache/thumbnails/normal/*'
shopt -u dotglob
Note: As suggested, I've tried using double-quotes "
in the script, but still getting the same error.
sudo chmod +x /usr/local/scripts/test.sh
The error I'm getting:
rm: cannot remove '/home/admn/.cache/thumbnails/normal/*': No such file or directory
Thanks.
Neither single nor double quotes will allow expansion of the
*
glob - that needs to be outside the quotes i.e.or
However, since your string doesn't contain any shell-special characters, you could omit the quotes altogether