From http://my.galagzee.com
==========================
I needed to restore some files from an archive on UNIX, but only the files of a particular date-range were needed. It took a few moments to find and figure out how I could easily extract files older than a particular date, or files from a particular date-range. This is how:
- Create a perimeter file, like so:
touch -t yyyymmddHHMM marker_date - List files older than the marker_date:
find . -type f ! -newer marker_date -ls
Of course, instead of `-ls’ parameter (to list), you can use `-print’ and a pipe to xargs to, for example, delete the selected files, etc.
Likewise, for a range of dates:
- Create the perimeter files:
touch -t yyyymmddHHMM range_start
touch -t yyyymmddHHMM range_end - List the files between the range dates:
find . -type f -newer range_start ! -newer range_end -ls
0 comments:
Post a Comment