...
Syntax
Wiki Markup |
*diskspace* _logical-name_\[=_path_\] \ [_qty_=_nnn_\{*b*\|*k*\|*m*\|*g*\}\] \ [_cond_=\{*GT*\|*LT*\}\]
Description
...
Parameters
...
cellspacing | 0 |
---|
style | text-align: left; width: 100%; |
---|
class | Table_with_Header |
---|
...
style | background-color: #F0F0F0; border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: middle; width: 144pt; |
---|
...
...
style | background-color: #F0F0F0; border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: middle; width: 360pt; |
---|
...
...
style | border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top; |
---|
...
...
...
| Name of the system where UDM checks available space. If path is specified, diskspace checks the volume or file system where that directory resides. Otherwise, the current working directory is used. |
...
...
style | border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top; |
---|
...
...
...
Amount of space that diskspace should look for. |
...
...
To specify a unit for the quantity, add one of the following letters to the quantity amount: - b - bytes
- k - kilobytes (1,024 bytes)
- m - megabytes (1,048,576 bytes)
- g - gigabytes (1,073,741,824 bytes)
|
...
If no unit is specified, the default (b - bytes) is used. |
...
If no quantity is specified, diskspace displays the available space. |
...
style | border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top; |
---|
...
...
...
style | border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top; |
---|
Instructs diskspace to check for an amount that is greater than (GT) or less than (LT) the specified quantity. |
...
This parameter is optional. If no condition is specified, GT is used. |
Examples
The following example displays the amount of space available on the volume or file system that contains the directory
c:\somedir
.
Panel |
html-bobswift |
---|
<pre>
open dst=ipaddr user=uid pwd=password
diskspace dst=c:\somedir
</pre>
|
The following example verifies that the available space for the volume or file system that contains the current working directory is greater than 10GB.
Panel |
html-bobswift |
---|
<pre>
open dst=ipaddr user=uid pwd=password
diskspace dst qty=10g
if $(_lastrc.result) EQ 0
echo "At least 10 GB is available"
else
echo "Less than 10 GB is available"
end
</pre>
|
The statements below repeat the previous example using the $(_diskspace) built-in variable with the
.gb
attribute.
Panel |
---|
Html bobswift |
<pre>
open dst=ipaddr user=uid pwd=password
diskspace dst
if $(_diskspace.gb) GE 10
echo "At least 10 GB is available"
else
echo "Less than 10 GB is available"
end
</pre>
|
The following example uses diskspace in the context of a
forfiles statement, using the file's size in the comparison.
Panel |
html-bobswift |
---|
<pre>
open dst=ipaddr user=uid pwd=password
forfiles local=c:\sourcedir\afile.txt fileattrib=yes
# Make sure we have enough space available
diskspace dst=c:\targetdir qty=$(_file.size) cond=GT
# We do, copy the file.
if $(_lastrc.result) EQ 0
copy local=$(_file) dst=c:\targetdir\$(_file)
end
end
</pre>
|
The statements below repeat the previous example using the $(_diskspace) built-in variable. The
if statement only allows the file copy if the number of bytes available on
c:
is greater than the size of the input file.
Panel |
html-bobswift |
---|
<pre>
open dst=ipaddr user=uid pwd=password
forfiles local=c:\sourcedir\afile.txt fileattrib=yes
# Make sure we have enough space available
diskspace dst=c:\targetdir
# We do, copy the file.
if $(_diskspace) GT $(_file.size)
copy local=$(_file) dst=c:\targetdir\$(_file)
end
end
</pre>
|
The following example uses diskspace in the context of a
forfiles loop, using the total size of several files to determine the quantity of space needed.
Panel |
---|
Html bobswift |
<pre>
set spaceNeeded=0
open dst=ipaddr user=uid pwd=password
forfiles local=/home/datadir/*.txt fileattrib=yes
set spaceNeeded=<$(spaceNeeded) + $(_file.size)>
end
# Make sure we have enough space available
diskspace dst=c:\targetdir qty=$(spaceNeeded) cond=GT
# Only execute the "forfiles" statement if we have enough space
# for all the files.
if <"$(_lastrc.message)" EQ "SUCCESS">
forfiles local=c:\sourcedir\*.txt
copy local=$(file) dst=c:\targetdir\$(_file)
end
end
</pre>
|
The statements below repeat the previous example using the $(_diskspace) built-in variable.
Panel |
---|
Html bobswift |
<pre>
set spaceNeeded=0
open dst=ipaddr user=uid pwd=password
forfiles local=/home/datadir/*.txt fileattrib=yes
set spaceNeeded=<$(spaceNeeded) + $(_file.size)>
end
# Make sure we have enough space available
diskspace dst=c:\targetdir
# Only execute the "forfiles" statement if we have enough space
# for all the files.
if $(_diskspace) GT $(spaceNeeded)
forfiles local=c:\sourcedir\*.txt
copy local=$(file) dst=c:\targetdir\$(_file)
end
end
</pre>
|
The following example would prevent a copy if the available space for the volume or file system that contains the specified directory is less than 20MB.
Panel |
html-bobswift |
---|
<pre>
open dst=ipaddr user=uid pwd=password
diskspace dst=c:\targetdir qty=20m cond=lt
if $(_lastrc.result) EQ 0
echo "Not enough space. Will not copy."
else
echo "OK to copy"
copy local=c:\sourcedir\somefile.txt dst=c:\targetdir\somefile.txt
end
The statements below repeat the previous example using the $(_diskspace) built-in variable with the {{.mb}} attribute.
open dst=ipaddr user=uid pwd=password
diskspace dst=c:\targetdir
if $(_diskspace.mb) LT 20
echo "Not enough space. Will not copy."
else
echo "OK to copy"
copy local=c:\sourcedir\somefile.txt dst=c:\targetdir\somefile.txt
end
</pre>
|