OP
URDRWHO
Guest
Thanks I'll give it a try.
This is a learning curve for me. Takes me back to the DOS days when I knew so many commands by heart. The learning curve is a bit different for me today than it was in 1978. I tell my wife that the HD in my brain is getting full.
It is 8:32 AM and I gave the cron a time of 8:33 AM --- I'll see what happens.
It is 8:34 and I just looked --- it worked.
Thanks.
This is a learning curve for me. Takes me back to the DOS days when I knew so many commands by heart. The learning curve is a bit different for me today than it was in 1978. I tell my wife that the HD in my brain is getting full.
It is 8:32 AM and I gave the cron a time of 8:33 AM --- I'll see what happens.
It is 8:34 and I just looked --- it worked.
Thanks.
Didn't work? Hmmm, it should have deleted any files that were in ~/.thumbnails, but it would not have deleted any files in any sub-folders. If all of the files you wanted to delete were in sub-direcories of .thumbnail, that would explain the problem.
The tilde '~' character is an alias/short-cut for /home/yourusername/, so ~/.thumbnails should work. But you could try specifying the full path (e.g.
home/yourusername/.thumbnails) in your cron job, just in case the expansion of the tilde did not work.
BTW: DO NOT use ~/home/yourusername/.thumbnail/*, as a parameter to rm as this would expand to:
rm /home/yourusername/home/yourusername/.thumbnail/*
Not the end of the world, but the command would just fail as it expands to a path that does not exist.
And especially DO NOT put a space between the ~ and the rest of the path like this:
rm ~ /home/username/.thumbnail/* as this may result in dire consequences!
If you want to remove all of the files in .thumbnail and all files in its subdirectories, you could do it in one line using the find command like this:
Use crontab -e to edit your existing job as per the above line of code! The cron job above will run every day at quarter past midnight (as per your last post) - so don't forget to change the date/time fields to suit your needs if you want it to run at a different time.Code:15 0 * * * find /home/yourusername/.thumbnails/ -type f -delete
The find command used in the cron job above will find all file-system objects that are files, residing in the .thumbnails directory (or any of its sub-directories) and delete them. It will not affect any other files/folders outside of ~/.thumbnail/ and will not remove any symbolic links, sub-directories or other file-system objects that are inside ~/.thumbnail/.
Thinking about it, I should probably have suggested using find in the first place, rather than using rm!![]()
![]()