<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>symlinkDirectory(String,String) -- make symbolic links for all files in a directory tree</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_read__Directory.html">next</a> | <a href="_remove__Directory.html">previous</a> | <a href="_read__Directory.html">forward</a> | <a href="_remove__Directory.html">backward</a> | <a href="_file_spmanipulation.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_file_spmanipulation.html" title="Unix file manipulation functions">file manipulation</a> > <a href="_symlink__Directory_lp__String_cm__String_rp.html" title="make symbolic links for all files in a directory tree">symlinkDirectory(String,String)</a></div> <hr/> <div><h1>symlinkDirectory(String,String) -- make symbolic links for all files in a directory tree</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>symlinkDirectory(src,dst)</tt></div> </dd></dl> </div> </li> <li><span>Function: <a href="_symlink__Directory_lp__String_cm__String_rp.html" title="make symbolic links for all files in a directory tree">symlinkDirectory</a></span></li> <li><div class="single">Inputs:<ul><li><span><tt>src</tt>, <span>a <a href="___String.html">string</a></span>, the path to an existing directory, the root of the source directory tree</span></li> <li><span><tt>dst</tt>, <span>a <a href="___String.html">string</a></span>, a path to the root of the destination directory tree, which may not exist yet</span></li> </ul> </div> </li> <li><div class="single">Consequences:<ul><li>The directory tree rooted at <tt>src</tt> is duplicated by a directory tree rooted at <tt>dst</tt>. The files in the source tree are represented by relative symbolic links in the destination tree to the original files in the source tree.</li> </ul> </div> </li> <li><div class="single"><a href="_using_spfunctions_spwith_spoptional_spinputs.html">Optional inputs</a>:<ul><li><span><tt>Exclude => </tt><span><span>default value {}</span>, a string containing a regular expression, or a list of such strings. If the base part of the name of a file in the source tree matches one of the regular expressions, then no link to it is created</span></span></li> <li><span><tt>Undo => </tt><span><span>a <a href="___Boolean.html">Boolean value</a></span>, <span>default value false</span>, whether to undo the symbolic links created in a previous application of this function. The directories in the destination directory tree will remain.</span></span></li> <li><span><tt>FollowLinks => </tt><span><span>a <a href="___Boolean.html">Boolean value</a></span>, <span>default value false</span>, whether to follow symbolic links in the source tree to directories</span></span></li> <li><span><tt>Verbose => </tt><span><span>a <a href="___Boolean.html">Boolean value</a></span>, <span>default value false</span>, whether to report the creation or deletion of each symbolic link</span></span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><table class="examples"><tr><td><pre>i1 : src = temporaryFileName() | "/" o1 = /tmp/M2-14617-1/</pre> </td></tr> <tr><td><pre>i2 : dst = temporaryFileName() | "/" o2 = /tmp/M2-14617-2/</pre> </td></tr> <tr><td><pre>i3 : makeDirectory (src|"a/")</pre> </td></tr> <tr><td><pre>i4 : makeDirectory (src|"b/")</pre> </td></tr> <tr><td><pre>i5 : makeDirectory (src|"b/c/")</pre> </td></tr> <tr><td><pre>i6 : src|"a/f" << "hi there" << close o6 = /tmp/M2-14617-1/a/f o6 : File</pre> </td></tr> <tr><td><pre>i7 : src|"a/g" << "hi there" << close o7 = /tmp/M2-14617-1/a/g o7 : File</pre> </td></tr> <tr><td><pre>i8 : src|"b/c/g" << "ho there" << close o8 = /tmp/M2-14617-1/b/c/g o8 : File</pre> </td></tr> <tr><td><pre>i9 : symlinkDirectory(src,dst,Verbose=>true) --symlinking: ../../../M2-14617-1/b/c/g -> /tmp/M2-14617-2/b/c/g --symlinking: ../../M2-14617-1/a/g -> /tmp/M2-14617-2/a/g --symlinking: ../../M2-14617-1/a/f -> /tmp/M2-14617-2/a/f</pre> </td></tr> <tr><td><pre>i10 : get (dst|"b/c/g") o10 = ho there</pre> </td></tr> <tr><td><pre>i11 : symlinkDirectory(src,dst,Verbose=>true,Undo=>true) --unsymlinking: ../../../M2-14617-1/b/c/g -> /tmp/M2-14617-2/b/c/g --unsymlinking: ../../M2-14617-1/a/g -> /tmp/M2-14617-2/a/g --unsymlinking: ../../M2-14617-1/a/f -> /tmp/M2-14617-2/a/f</pre> </td></tr> </table> Now we remove the files and directories we created.<table class="examples"><tr><td><pre>i12 : rm = d -> if isDirectory d then removeDirectory d else removeFile d o12 = rm o12 : FunctionClosure</pre> </td></tr> <tr><td><pre>i13 : scan(reverse findFiles src, rm)</pre> </td></tr> <tr><td><pre>i14 : scan(reverse findFiles dst, rm)</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_symlink__File.html" title="make a symbolic link to a file">symlinkFile</a> -- make a symbolic link to a file</span></li> <li><span><a href="_copy__Directory_lp__String_cm__String_rp.html" title="">copyDirectory</a></span></li> </ul> </div> </div> </body> </html>