Milano
Milano

Reputation: 18745

Set excluded files using pattern or wildcard in PyCharm (remote host)

I use PyCharm to deploy and upload changes on my VPS. This project isn't on Git so I can't use .gitignore.

I find excluded paths in PyCharm deployment configuration very handy but I can't figure out if and how can I use wildcards to let pycharm know which files I want to exclude.

For example, I want not to upload *.pyc files. For now, I would have to specify paths for all *.pyc files.

enter image description here

Is it possible? I didn't find anything.

Upvotes: 2

Views: 814

Answers (1)

Piotr Jurkiewicz
Piotr Jurkiewicz

Reputation: 1799

There are two ways to exclude folders from upload/download:

  1. Explicitly, by marking the corresponding paths as excluded in the Remote Host tool window, or in the Excluded Paths tab of the Deployment dialog box.

    In the Remote Host tool window, you can exclude both entire folders and specific files.

  2. By name, that is, by specifying patterns that determine the names of files and folders to be excluded in the Exclude Items by Name text box of the Options dialog box.

Separate files can be protected against upload/download only through excluding them by name.

Excluding files and folders from upload/download by name

Open the Options dialog box by doing one of the following:

  • On the main menu, choose Tools | Deployment | Options.

  • Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PyCharm | Preferences for macOS. Expand the Build, Execution, Deployment node, and then click Options under Deployment.

In the Options dialog box that opens, specify the patterns that define the names of these files and folders in the Exclude items by name text box. Use semicolons as delimiters. Wildcards are welcome.

The exclusion is applied recursively. This means that if a matching folder has subfolders, the contents of these subfolders are not deployed either.

https://www.jetbrains.com/help/pycharm/2017.3/options.html

Upvotes: 1

Related Questions