Report recently changed files with the directory hierarchy preserved (command line)

This little command is very useful eg if you want to find out what files in your project have been modified recently. The beauty of the script is not only it outputs a list of files in your terminal but it also zips them up (or tars in this case) preserving the whole hierarchy of folders. The tar file can then be gzipped, bzip2ed or simply untarred so you can review the folders structure and your modified files.

Here’s an example of a command that displays the files modified within last two weeks on the screen, tars them and saves the tar file on your desktop. I tested this script both on the Mac and Linux.

$ tar cvf - `find /var/www/my_project -type f -mtime -14 -print` > ~/Desktop/project_recent_changes.tar

Tags: ,

Leave a Reply

You must be logged in to post a comment.