<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=File.parent</id>
	<title>File.parent - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=File.parent"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.parent&amp;action=history"/>
	<updated>2026-04-10T16:37:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File.parent&amp;diff=751&amp;oldid=prev</id>
		<title>JoeStrout: Created page with &quot;The &lt;c&gt;file.parent&lt;/c&gt; method returns the parent path of the given file or directory, that is, the path of the directory that contains it.  === Arguments ===  {| class=&quot;wi...&quot;</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.parent&amp;diff=751&amp;oldid=prev"/>
		<updated>2021-07-17T04:21:30Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &amp;lt;c&amp;gt;&lt;a href=&quot;/wiki/File&quot; title=&quot;File&quot;&gt;file&lt;/a&gt;.parent&amp;lt;/c&amp;gt; method returns the parent path of the given file or directory, that is, the path of the directory that contains it.  === Arguments ===  {| class=&amp;quot;wi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;lt;c&amp;gt;[[file]].parent&amp;lt;/c&amp;gt; method returns the parent path of the given file or directory, that is, the path of the directory that contains it.&lt;br /&gt;
&lt;br /&gt;
=== Arguments ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter Name !! Default Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| path || &amp;quot;&amp;quot; || file name, partial path, or absolute path to file or directory to get the parent of&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If given a file name or partial path, it will be interpreted relative to the current working directory (see &amp;lt;c&amp;gt;[[file.curdir]]&amp;lt;/c&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Result ===&lt;br /&gt;
&lt;br /&gt;
This method returns a string containing the parent directory of the given file or directory.  '''Note:''' if given the root path, &amp;quot;/&amp;quot;, it returns &amp;quot;/&amp;quot; again — this is the only directory that is its own parent.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following attempts to delete a file called &amp;quot;test.txt&amp;quot; in the [[file.curdir|current directory]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;s = &amp;quot;/sys/pics/food/Sushi.png&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
    print file.name(s)&lt;br /&gt;
    s = file.parent(s)&lt;br /&gt;
    if s == &amp;quot;/&amp;quot; then break&lt;br /&gt;
    print &amp;quot;...which is contained in...&amp;quot;&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above, if run on Mini Micro (or any system with a similar directory structure), prints:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Sushi.png&lt;br /&gt;
...which is contained in...&lt;br /&gt;
food&lt;br /&gt;
...which is contained in...&lt;br /&gt;
pics&lt;br /&gt;
...which is contained in...&lt;br /&gt;
sys&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line MiniScript]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
</feed>