One of the tricks I’ve frequently had to use was to discover all the recently modified files within a hosting account (very useful information in case the account was recently hacked and changed files need to be restored).

For this exact purpose, there’s a good combination of linux commands we can use

where X is the number of days (positive, negative, or zero); for example, to list all files modified in the past 3 days, replace X with -3:

This little command works well for most situations, but will fail in case file names have spaces in them. For this situation, we need to do a temporary change in the linux environment configuration, then revert that change.This is where the IFS variable comes into play.

Other timeframes for the mtime parameter:

Leave a Reply