LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Command or script to create aged test directories and files. (https://www.linuxquestions.org/questions/linux-newbie-8/command-or-script-to-create-aged-test-directories-and-files-4175423446/)

slandrs 08-22-2012 10:23 AM

Command or script to create aged test directories and files.
 
I need to create directories and files with aging that can be listed via "find /tmp -mtime 99 ..." command to test housekeeping and reporting automation.

Is there a touch or similar command or script that I can use on a directory or file to advance the age of the object for the above find command to detect? I need to create objects of dates on either side of the find -mtime option to prove correct filtering.

I also need to implement an exclude file to prevent the find command from listing unintended filesystem content.

Thanks, Steve

I found my solution in: touch -c -t 04050607 t;ls -l;pwd
The find command will locate it as being an aged file of greater than 111 days old.

Kustom42 08-22-2012 01:27 PM

Slandrs, glad you found the solution but to save other peoples time from reading this over thinking you still need help you should select the "Mark this thread as solved" option from the "Thread Tools" drop down menu on the top of the thread.


All times are GMT -5. The time now is 06:40 PM.