<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can get the volume of a specified folder directly using JSL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/771525#M95214</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-07-09_11-29-16.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65964iD6FB6A2C234C3C3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-07-09_11-29-16.png" alt="2024-07-09_11-29-16.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2024 03:42:02 GMT</pubDate>
    <dc:creator>lala</dc:creator>
    <dc:date>2024-07-09T03:42:02Z</dc:date>
    <item>
      <title>How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631419#M82964</link>
      <description>&lt;P&gt;For example, this folder:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;C:\Windows&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:09:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631419#M82964</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-06-09T16:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631436#M82969</link>
      <description>&lt;P&gt;I don't believe it can be derived directly.&amp;nbsp; Here is what I cam up with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
theList = Files In Directory( "C:\Windows" );
totSize = 0;
For Each( {theFile}, theList,
	totSize = Sum( totSize, File Size( "C:\Windows\" || theFile ) )
);
Show( totSize );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But it doesn't appear to be accurate&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 11:47:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631436#M82969</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-05-12T11:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631505#M82983</link>
      <description>&lt;P&gt;Thank Jim!&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 13:06:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631505#M82983</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-05-12T13:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631543#M82987</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;Yes, this result is obviously incorrect.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 12 May 2023 14:09:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631543#M82987</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-05-12T14:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631565#M82991</link>
      <description>&lt;P&gt;It might be better to perform this type of check using Run Program and some command with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With Files In Directory you will have to add recursive(1) (or perform a loop yourself, to get files inside folders).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
lookup_dir = "C:\Windows\";
file_list = Files In Directory(lookup_dir, recursive(1));
file_sizes = Transform Each({cur_file}, file_list,
	File Size(lookup_dir || cur_file)
);
sum(file_sizes);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/17.0/#page/jmp/file-functions.shtml?os=win&amp;amp;source=application#ww4951479" target="_blank"&gt;https://www.jmp.com/support/help/en/17.0/#page/jmp/file-functions.shtml?os=win&amp;amp;source=application#ww4951479&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use Multiple File Import for this &lt;LI-MESSAGE title="Directory Tree: Explore Space Used by Folders" uid="456571" url="https://community.jmp.com/t5/Uncharted/Directory-Tree-Explore-Space-Used-by-Folders/m-p/456571#U456571" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 14:35:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631565#M82991</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-12T14:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631633#M82999</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;suggested, here's a way to do it using Run Program / Powershell (from JMP, of course).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN.  BY USING THE CODE, YOU AGREE TO THESE TERMS.  YOUR USE OF THE CODE IS AT YOUR OWN RISK.  JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose.  The Code is designed to add functionality to the Software but has not necessarily been tested.  Accordingly, JMP makes no representation or warranty that the Code will operate error-free.  JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages.  Except as otherwise provided above, the Code is governed by the same agreement that governs the Software.  If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries.  ® indicates USA registration.  Other brand and product names are registered trademarks or trademarks of their respective companies.
*/

Names Default To Here( 1 );
op = {};
rp = Run Program(
	Executable( "powershell.exe" ),
	Options( "ls c:\temp\ -r | measure -sum Length" ), //Replace c:\temp\ with your folder
	ReadFunction( Function( {this}, Insert Into( op, this &amp;lt;&amp;lt; read ) ) )
);

for each ({i}, op,
	if (word(1, i) == "Sum", totalsize = num(regex (i, "([0-9]+)")))
);

show (totalsize);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2023 20:32:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/631633#M82999</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2023-05-12T20:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/771523#M95213</link>
      <description>&lt;P&gt;Now GPT-4o is very powerful, it can do ordinary programming:&lt;/P&gt;&lt;P&gt;In the win10 system, the volume size of each directory of the C disk (including hidden files), the specific requirements are:&lt;BR /&gt;Starting from the root directories of drive C,&lt;BR /&gt;1, if the subdirectory of this directory is more than 3 layers, it can be expanded to the third layer directory, statistics of the respective volume of each directory contained in the third layer directory&lt;BR /&gt;2, if the subdirectory of this directory does not exceed 3 layers, the statistics of the expansion of this directory to the last layer of the directory of the respective volume&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;t1=tick seconds();run program(executable("cmd.exe"),options({"/c powershell -Command \!"&amp;amp; {$results = @(); Get-ChildItem C:\ -Directory -Force | ForEach-Object { $topDir = $_; $subDirs = Get-ChildItem $topDir.FullName -Recurse -Directory -Force -ErrorAction SilentlyContinue | Where-Object { ($_.FullName.Split('\').Length - 1) -le 3 }; if ($subDirs) { $subDirs | ForEach-Object { $size = (Get-ChildItem $_.FullName -Recurse -File -Force -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum; $results += [PSCustomObject]@{ Path = $_.FullName; 'Size (MB)' = [math]::Round($size / 1MB, 2) } } } else { $size = (Get-ChildItem $topDir.FullName -Recurse -File -Force -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum; $results += [PSCustomObject]@{ Path = $topDir.FullName; ')' = [math]::Round($size / 1MB, 2) } } }; $results | Export-Csv -Path 'D:\目录大小.csv' -NoTypeInformation -Encoding UTF8}\!""}));
t2=tick seconds();t=t2-t1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jul 2024 03:41:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/771523#M95213</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-07-09T03:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can get the volume of a specified folder directly using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/771525#M95214</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-07-09_11-29-16.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65964iD6FB6A2C234C3C3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-07-09_11-29-16.png" alt="2024-07-09_11-29-16.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 03:42:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-get-the-volume-of-a-specified-folder-directly-using-JSL/m-p/771525#M95214</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-07-09T03:42:02Z</dc:date>
    </item>
  </channel>
</rss>

