Script with find command and -delete not recognized

  • When I run a script, to create a tar backup and delete files older than 7 days, with the find command it doesn't do -delete

    I don't understand what I'm doing wrong. I wrote/copied, from internet, the script in notepad++ on windows 10. As you can see in below screenshot the code and the error I get. Th TAR file is being made, that works.

  • I can run the same command successfully here, so I think this might be a Windows line-endings issue which results in something being added to the command that "find" can't interpret. Run dos2unix on the file and see if that fixes the problem?

  • Thanks.

    I don't get any errors now but it doesn't delete any files. As you can see in below image there are more than 7 files. I even changed chmod of the first 2 files to 777 to see if that was the problem, it was not....