Recent Files and Creating Symbolic Links
Don Erickson
derick at zeni.net
Sun Mar 6 18:17:33 CST 2005
On Sun, 6 Mar 2005, Jonathan Hutchins wrote:
> Rather than pipe the output to a text file, use the "exec" option of find to
> execute the symlink command - something like
>
> find /path/ -mtime 48 -name '*.jpg' -exec -s /path/{} WhatsNew/{} \;
While not as elegant as Jonathan's solution, the following has the
advantage or totally regenerating the new picture links when it is run -
first cd to the directory with your photos:
----8<-------------------------------
#! /usr/bin/perl
system("rm -r newpix; mkdir newpix");
(@newpix)=qx (find . -mtime -3 -name '*.jpg');
print "@newpix\n";
foreach $_ (@newpix) {
chomp ($link =($_));
$newlink = "newpix/$link";
system ("ln -s '$link' '$newlink'");
};
print "\n\nDone.\n";
exit;
---->8---------------------------
This will link to files created in the last 36 hours, the -3
(days) argument to mtime.
Regards,
-Don
More information about the Kclug
mailing list