Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor
1154173
1154173
Syntax

Wiki Markup*diskspace* _logical-name_\[=_path_\] \ [_qty_=_nnn_\{*b*\|*k*\|*m*\|*g*\}\] \ [_cond_=\{*GT*\|*LT*\}\]

Anchor
1154175
1154175
Description

...

Anchor
1154185
1154185
Parameters

...

cellspacing0
styletext-align: left; width: 100%;
classTable_with_Header

...

...

Parameter

...

...

Description

...

styleborder-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;

...

...

logical_name

...

styleborder-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.

...

Note

On z/OS and IBM i, the current file system must be set to HFS (see the filesyscommand).

...

styleborder-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;

...

...

qty

...

styleborder-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.

...

styleborder-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;

...

If no quantity is specified, diskspace displays the available space.

...

cond

...

styleborder-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.

Anchor
1154214
1154214
Examples


Anchor
1154215
1154215
The following example displays the amount of space available on the volume or file system that contains the directory c:\somedir.

Panel
open dst=ipaddr user=uid pwd=password
diskspace dst=c:\somedir


Anchor
1154219
1154219
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
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


Anchor
1154228
1154228
The statements below repeat the previous example using the $(_diskspace) built-in variable with the .gb attribute.

Panel
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


Anchor
1154240
1154240
The following example uses diskspace in the context of a forfiles statement, using the file's size in the comparison.

Panel


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



Anchor
1154258
1154258
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


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



Anchor
1154258
1154258
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


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



Anchor
1154258
1154258
The statements below repeat the previous example using the $(_diskspace) built-in variable.

Panel


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



Anchor
1154258
1154258
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


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


Anchor
1124154
1124154