checking files buy date
Hi Linux Guru's
can you guide me on which command to use? I'm trying to check on the files that are dated 2015-07-16 to latest but I'm having a different results I've tried these but gives me a wrong echo Code:
[pog@gwapo file]$ ls grep file.log.2015-07-{16..21} The files to check is this: Code:
-rw-r--r-- 1 pogi pogi 9.3K Jun 7 05:46 file.log.2015-06-07-054449 |
You are very close. Remove the "grep" (why did you put it there in the first place?). Then add an asterisk to the file name pattern.
However, this only works if "latest" is the 21st. |
Quote:
Code:
[pogi@gwapo file]$ ls -ltrh file.log.2015-07-{16..21}* |
Quote:
Code:
ls -ltrh file.log.2015-07-16* file.log.2015-07-17* file.log.2015-07-18* file.log.2015-07-19* file.log.2015-07-20* file.log.2015-07-21* Code:
file.log.2015-07-17* Apart from giving you an ugly error message, it is harmless and you can just send the message to /dev/null. Also, you can change the default shell behaviour regarding unmatched globs with Code:
shopt -s nullglob |
Quote:
Or more precisely: When you type "ls grep", the "ls" command will look up a file named grep. Since it doesn't find this file, it complains. So, leave the "grep" out of your command and you are half-way there. In addition, your original command looked for files that end in 16, 17, ..., 21. However the filenames in your directory don't end with this number. So, add an asterisk, which stands for "any string". |
Quote:
Code:
find . -maxdepth 1 -mtime -6 | sort |
All times are GMT -5. The time now is 12:14 AM. |