1. XRootD.client.FileSystem: Filesystem-based operations

1.1. Class Reference

class XRootD.client.FileSystem(url)[source]

Interact with an xrootd server to perform filesystem-based operations such as copying files, creating directories, changing file permissions, listing directories, etc.

Parameters

url (string) – The URL of the server to connect with

1.1.1. Attributes

FileSystem.url

The server URL object, instance of XRootD.client.URL

1.1.2. Methods

FileSystem.copy(source, target, force=False)[source]

Copy a file.

Note

This method is less configurable than using XRootD.client.CopyProcess - it is designed to be as simple as possible by using sensible defaults for the underlying copy job. If you need more configurability, or want to make multiple copy jobs run at once in parallel, use XRootD.client.CopyProcess.

Parameters
  • source (string) – Source file path

  • target (string) – Destination file path

  • force (boolean) – overwrite target if it exists

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.locate(path, flags, timeout=0, callback=None)[source]

Locate a file.

Parameters
Returns

tuple containing XRootD.client.responses.XRootDStatus object and XRootD.client.responses.LocationInfo object

FileSystem.deeplocate(path, flags, timeout=0, callback=None)[source]

Locate a file, recursively locate all disk servers.

Parameters
Returns

tuple containing XRootD.client.responses.XRootDStatus object and XRootD.client.responses.LocationInfo object

FileSystem.mv(source, dest, timeout=0, callback=None)[source]

Move a directory or a file.

Parameters
  • source (string) – the file or directory to be moved

  • dest (string) – the new name

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.query(querycode, arg, timeout=0, callback=None)[source]

Obtain server information.

Parameters
Returns

the query response or None if there was an error

Return type

string

Note

For more information about XRootD query codes and arguments, see the relevant section in the protocol reference.

FileSystem.truncate(path, size, timeout=0, callback=None)[source]

Truncate a file.

Parameters
  • path (string) – path to the file to be truncated

  • size (integer) – file size

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.rm(path, timeout=0, callback=None)[source]

Remove a file.

Parameters

path (string) – path to the file to be removed

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.mkdir(path, flags=0, mode=0, timeout=0, callback=None)[source]

Create a directory.

Parameters
Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.rmdir(path, timeout=0, callback=None)[source]

Remove a directory.

Parameters

path (string) – path to the directory to remove

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.chmod(path, mode, timeout=0, callback=None)[source]

Change access mode on a directory or a file.

Parameters
Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.ping(timeout=0, callback=None)[source]

Check if the server is alive.

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.stat(path, timeout=0, callback=None)[source]

Obtain status information for a path.

Parameters

path (string) – path to the file/directory to stat

Returns

tuple containing XRootD.client.responses.XRootDStatus object and XRootD.client.responses.StatInfo object

FileSystem.statvfs(path, timeout=0, callback=None)[source]

Obtain status information for a Virtual File System.

Parameters

path (string) – path to the file/directory to stat

Returns

tuple containing XRootD.client.responses.XRootDStatus object and XRootD.client.responses.StatInfoVFS object

FileSystem.protocol(timeout=0, callback=None)[source]

Obtain server protocol information.

Returns

tuple containing XRootD.client.responses.XRootDStatus object and XRootD.client.responses.ProtocolInfo object

FileSystem.dirlist(path, flags=0, timeout=0, callback=None)[source]

List entries of a directory.

Parameters
Returns

tuple containing XRootD.client.responses.XRootDStatus object and XRootD.client.responses.DirectoryList object

Warning

Currently, passing DirListFlags.STAT with an asynchronous call to XRootD.client.FileSystem.dirlist() does not work, due to an xrootd client limitation. So you’ll get None instead of the StatInfo instance. See the GitHub issue for more details.

FileSystem.sendinfo(info, timeout=0, callback=None)[source]

Send info to the server (up to 1024 characters).

Parameters

info (string) – the info string to be sent

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.prepare(files, flags, priority=0, timeout=0, callback=None)[source]

Prepare one or more files for access.

Parameters
  • files (list) – list of files to be prepared

  • flags – An ORed combination of XRootD.client.flags.PrepareFlags

  • priority (integer) – priority of the request 0 (lowest) - 3 (highest)

Returns

tuple containing XRootD.client.responses.XRootDStatus object and None

FileSystem.set_property(name, value)[source]

Set file system property.

Parameters

name (string) – name of the property to set

Returns

boolean denoting if property setting was successful

Return type

boolean

FileSystem.get_property(name)[source]

Get file system property.

Parameters

name (string) – name of the property