Recent Files and Creating Symbolic Links

Jonathan Hutchins hutchins at tarcanfel.org
Sun Mar 6 17:15:11 CST 2005


On Sunday 06 March 2005 02:30 pm, Jon Moss wrote:

> find /path/to/photos -mtime 48 -name '*.jpg' [> textfile]

> Then, I wanted to create symbolic links to the JPG files but I wanted to
> use the text file to pipe the information to the ln command.

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/{} \;

(I had to trim the paths to keep the command from wrapping, but you get the 
general idea.)

The man page for find has some details on using the -exec option; they caution 
that the double braces that substitute the current filename might need to be 
quoted or escaped as does the semicolon that ends the command string, 
depending on context and the shell.


More information about the Kclug mailing list