Ignore-regex for folder and subfolders in Sublime Text SFTP plugin
-
16-06-2021 - |
Pregunta
I've been in some trouble getting the ignore_regex
option working in the Sublime SFTP plugin for Sublime Text. I'm not that good with regex, though I guess this should be fairly easy
My folder structure is pretty simple:
main_folder
│
├─── css
│ │ some other files
│ │ in the \css folder,
│ │ etc..
│ │
│ └─── sass
│ │ some other files
│ │ in the \sass folder,
│ │ etc..
│ │
│ └─── sass_subfolders
│ some other files
│ in \sass_subfolders,
│ etc..
├─── other_folders
│
etc...
I'd like that everything in the \sass
folder, and the folder itself, to be ignored by sftp for uploading/syncing.
I've tried also with the configuration suggested in this post on the sublime forum , specifing to exclude the .scss files, yet it keeps uploading/syncing upon save and so on..
Solución
To have an entire directory ignored by sublime sftp add it to your ignore_regexes settings like so:
"/folder_name/"
I use it to ignore octopress which generates my blog but doesn't need to be on the remote server itself. I also ignore the directory on the server that holds the generated blog, but doesn't live on my local machine in the same place.
This and a few more tips are on the plugin's faq page.
Otros consejos
Applying the accepted answer, add the folder you want to ignore into the ignore_regexes
array in sftp-config.json
. But you also need to know the default settings of ignore_regexes
first wbond ref. For example, if you want to add "/folder_name/" folder, the final array will look like:
"ignore_regexes": ["\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json", "sftp-settings\\.json", "/venv/", "\\.svn", "\\.hg", "\\.git", "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini", "/folder_name/"],
Just used this to remove a few folders from the sync settings (these are folders on the server that i don't want, i only wanted the files at the root level.)
"ignore_regexes": [ "\.sublime-(project|workspace)", "sftp-config(-alt\d?)?\.json", "sftp-settings\.json", "/venv/", "\.svn/", "\.hg/", "\.git/", "\.bzr", "_darcs", "CVS", "\.DS_Store", "Thumbs\.db", "desktop\.ini","/MySQL/","/_admin/","/admin/" ],
is my setting for this, the folders i am ignoring are: MySQL _admin admin
really helpful setting, it saved me downloading 100's of MB worth of data!
Seems you should be able to just add in:
"ignore_regex": "(css/sass/|ignore/this/too)"