# Table.add\_files

### Table.<mark style="color:purple;">add\_files</mark>(*\*, files=None, directory=None,* max\_parallelization=os.cpu\_count() \* 5) → list([File](/api/client-libraries/redivis-python/reference/file.md))

Uploads either a list of files or all files in a directory to an [index table](https://docs.redivis.com/reference/datasets/files#folders-and-index-tables). The index table must be on an unreleased version. Attempting to add files to a non-index table will result in an error.

### **Parameters:**

**`files` :&#x20;*****list(str)*****&#x20;|&#x20;*****list(dict\<path=str, name=str, data=str | bytes>), default None***\
A list of files to upload. Either this or `directory` must be specified, but not both. Can either be a list of file paths, or a list of dicts with the keys `path`, `name`, and/or `data`. \
\
If providing a list of dicts, each dict must specify either `path` (the path to the file on disk) or `data`, representing the content to upload. `name` is optional if `path` is specified (defaulting to the file name), but required if `data` is specified.

**`directory` :&#x20;*****str, default None***\
A directory of files to upload. Either this or `files` must be specified, but not both. All files in the directory will be uploaded, including hidden files and those in any subdirectories.

**`max_parallelization` :&#x20;*****int, default os.cpu\_count() \* 5***\
The maximum concurrency when uploading files. If you have lots of small files, you may want to increase the concurrency, while you may want to decrease it if you have just a few large files.

### **Returns:** &#x20;

**list(**[**File**](/api/client-libraries/redivis-python/reference/file.md)**)**

### **Examples:**

```python
dataset = redivis.user("my_username").dataset("my_dataset")

table = dataset.table("my_files")
# If the file index table doesn't already exist, we can create it
# table.create(is_file_index=True)

# upload all contents in a directory
table.add_files(directory="/path/to/directory/")

# upload specific files
table.add_files(files=list(
    {"path": "/path/to/file.png"}, # file name will be "file.png"
    {"path": "/path/to/other/file.png", "name": "other_file.png"}, # file name will be other_file.png
    {"data": "Hello world", "name": "hello_world.txt"} # Data can be string or bytes 
)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redivis.com/api/client-libraries/redivis-python/reference/table/table.add_files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
