---
schema_version: "1"
id: 27db9f2cfe57986516a8b06f1bc3ae6e6f7146e316f652f90e007353140bf5a7
title: project convert source
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/project/cli_reference_project_convert_source.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_project_convert_source.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 42968807528053616bb33ff61d483fe25e02fb27f85b64a4376eac43b7147fa9
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# project convert source

Convert source-formatted files into metadata that you can deploy using Metadata API.

## Description for project convert source

To convert source-formatted files into the metadata format, so that you can deploy them using Metadata API, run this command. Then deploy the metadata using "sf project deploy".

To convert Metadata API–formatted files into the source format, run "sf project convert mdapi".

To specify a package name that includes spaces, enclose the name in single quotes.

To convert multiple components, either set multiple --metadata &lt;name&gt; flags or a single --metadata flag with multiple names separated by spaces. Enclose names that contain spaces in one set of double quotes. The same syntax applies to --source-dir.

## Aliases for project convert source

`force:source:convert`

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>API Version to use in the generated project's manifest. By default, will use the version from sfdx-project.json<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;manifest</code> | <code>&#8209;x</code> | **Type:** Value<br><br>Path to the manifest (package.xml) file that specifies the metadata types to convert.<br><br>If you specify this flag, don’t specify --metadata or --source-dir. |
| <code>&#8209;&#8209;metadata</code> | <code>&#8209;m</code> | **Type:** Value<br><br>Metadata component names to convert. |
| <code>&#8209;&#8209;output&#8209;dir</code> | <code>&#8209;d</code> | **Type:** Value<br>**Default value:** `metadataPackage_1790799200780`<br><br>Output directory to store the Metadata API–formatted files in. |
| <code>&#8209;&#8209;package&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br><br>Name of the package to associate with the metadata-formatted files. |
| <code>&#8209;&#8209;root&#8209;dir</code> | <code>&#8209;r</code> | **Type:** Value<br><br>Source directory other than the default package to convert. |
| <code>&#8209;&#8209;source&#8209;dir</code> | <code>&#8209;p</code> | **Type:** Value<br><br>Paths to the local source files to convert.<br><br>The supplied paths can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and its sub-directories).<br><br>If you specify this flag, don’t specify --manifest or --metadata. |

## Examples for project convert source

Convert source-formatted files in the specified directory into metadata-formatted files; writes converted files into a new directory:

```shell
sf project convert source --root-dir path/to/source
```

Similar to previous example, but writes converted files to the specified output directory and associates the files with the specified package:

```shell
sf project convert source --root-dir path/to/source --output-dir path/to/outputdir --package-name 'My Package'
```
<!-- prettier-ignore-end -->
