2

So far I've been basing my efforts around this blog and have come up with:

startdate=”201407010000?
enddate=”201408010000?
touch -t $startdate ./startdatefiles
touch -t $enddate ./enddatefiles
find ./ -type f -newer ./startdatefiles ! -newer ./enddatefiles -ls

I get the following error:

touch: invalid date format `201408010000?'

Does any one know of a straight forward way to do this?

  • duplicate: stackoverflow.com/q/26076104/7552 – glenn jackman Sep 27 '14 at 19:15
  • I know the author of that blog. I think he moved the blog from another server in the past months and probably did not clear the formatting. I'll contact him to correct the formatting on that article. But like what slhck said, be careful when you past code from articles. – R J Sep 29 '14 at 6:04
  • 1
    @RJ Thanks - Looks like it has been updated :-) – atomh33ls Sep 29 '14 at 7:50
3

Don't end your variable assignment with a ?, but a " instead.

And get rid of the typographic quotes the author used instead of using proper typewriter quotes.

startdate="201407010000"
enddate="201408010000"

Obviously, the author of this blog has never checked the formatting of their post.

As a more general tip, be cautious about copy-pasting stuff from random articles on the Internet. Rather try to come up with the solution yourself (or at least type it out in the shell), then you'd have seen what the problem is.

  • 1
    Thanks. re general tip - agreed this was a tad lazy on my part in hindsight. But it might one day be useful to someone else as well. – atomh33ls Sep 27 '14 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.