MANAGEDATASET

Copy, delete, rename, move, or list files of a data set


EnvironmentsPYTHON :: EASI
Quick linksDescription :: Parameters :: Parameter descriptions :: Return Value :: Details :: Example :: Related

Back to top

Description


MANAGEDATASET helps you manage data sets. You can use the algorithm to copy, delete, rename, move, or list the files of a data set.
Back to top

Parameters


managedataset(file, outdir, newbase, operation, options)

Name Type Caption Length Value range
FILE* str Input data set to manage 1 -  
OUTDIR str Name of output folder 0 -    
NEWBASE str Base name of renamed data set 0 -  
OPERATION str Operation to apply to input data set 0 -   LIST | LS | DIR | COPY | CP | MOVE | MV | RENAME | DELETE | RM
Default: LIST
OPTIONS str Options to apply 0 -    

* Required parameter
Back to top

Parameter descriptions

FILE

The file name of the data set to manage.

The name must be the key file, or primary file, of the entire data set.

Note: Linked PCIDSK (.pix) files created with the LINK algorithm are not supported by MANAGEDATASET. If you specify a linked PCIDSK file, the algorithm will throw an exception.

OUTDIR

When copying or moving files, the name of output folder to which to write the copied or moved data set.

Note: If any files exist in the output folder that will, potentially, be overwritten during processing, and NO_OVERWRITE is specified for OPTIONS, the algorithm will throw an exception.

NEWBASE

When renaming a data set, the base name to use for renamed files and subfolders.

Renaming applies only to formats that support renaming. If the format of the input file does not support renaming, the algorithm throws an exception.

OPERATION

The operation to apply to the input data set.

You can specify the following:

If you do not specify a value for this parameter, LIST is applied.

OPTIONS

The option or options to apply during processing.

When specifying more than one, separate each with a space, comma, or semicolon.

To control whether to overwrite files in the output folder, you can specify the following options: When you do not specify a value to overwrite files, NO_OVERWRITE is applied.
To control how the report is compiled, you can specify the following options:
To control how the paths of input and output files and folders are written to the report, you can specify the following options: When you do not specify a value to control how paths are written, RELATIVE is applied.

When you do not specify any values for OPTIONS, NO_OVERWRITE, QUIET, and RELATIVE are applied.

Back to top

Return Value

Returns: Number of files processed

Type:  PCI_INT

Parameter: LASC

The return value is the total number of files that were processed. For example: to determine the number of files in a dataset run MANAGEDATASET with the LIST operation.

When called from EASI, the return value is written to the LASC parameter in the PRM file.

Back to top

Details

You use MANAGEDATASET to copy, delete, rename, move, or list the files of a data set.

For example, when you want to copy a shapefile (.shp), all its associated files (.dbf, .prj, .shp, .shx) must also be copied. Run MANAGEDATASET to copy the shapefile and all associated files to the output folder you specify.

Note: Not all data set formats support all operations. When a data set is not supported, the algorithm throws an exception.
Back to top

Example

In the following example, the roadseg.shp data set is copied to the roadseg-copy folder.

from pci.managedataset import managedataset
file="roadseg.shp"           # input data set to copy
outdir="roadseg-copy"        # output folder to which to copy the data set
basename=""
operation="COPY"
options="VERBOSE"            # write detailed information to the report
managedataset(file, outdir, basename, operation, options)
      

© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.