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

1.1. Class Reference

class XRootD.client.FileSystem(url)

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)

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)

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)

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)

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)

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)

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)

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)

Create a directory.

Parameters:
Returns:

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

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

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=0, timeout=0, callback=None)

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)

Check if the server is alive.

Returns:tuple containing XRootD.client.responses.XRootDStatus object and None
FileSystem.stat(path, timeout=0, callback=None)

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)

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)

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)

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)

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)

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

Table Of Contents

Previous topic

3. CopyProcess examples

Next topic

2. XRootD.client.File: File-based operations

This Page