Bash script list files by date
This is what I've got so far:! What I'm I doing wrong here? Lars Lars 4 4 silver badges 11 11 bronze badges. Add a comment. Active Oldest Votes. This worked perfectly and I think it's the cleanest solution. Thank you — Lars. Furthermore, how would I go about hard coding a specific directory here? This script will print all files whose names represent dates newer than the present:! Improvement If the above script were to be interrupted in progress, it would leave a stray file in the directory.
To make sure that that file is always removed, we can use a trap :! John John k 11 11 gold badges silver badges bronze badges. Sorry if I misspoke by saying "print", but I'd like to view the results in console after running like echo. How would I update this to use echo instead of printing to stdout? Thanks — Lars. Lars This should work just like echo. Printing to stdout is exactly what echo does. Ah ok. I'm just not seeing any results as there are probably no future files in my directory at this time.
I will mark this as answer. Thank you for a clear and detailed answer. You can try something like this:! In a file i have a string like this which is the date of today Sa 4.
Improve this question. Add a comment. Active Oldest Votes. Something like:! Improve this answer. Iain Lane Iain Lane 2, 23 23 silver badges 26 26 bronze badges. See what -q does.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 5 years ago. Active 5 years ago. Viewed 6k times. Someone help sample file name patter and location. Improve this question. Codebeginner Codebeginner 13 1 1 silver badge 3 3 bronze badges.
Could you please edit your question to show some examples of inputs and the desired outcome, along with what you've tried and what about it didn't work the way you wanted it to? Add a comment.
0コメント