As the title says, I would like to exclude temporary FTP files from the fuzzy search.
The files to exclude are in the following directory: C:/Users/[USER]/AppData/Local/Temp/*
Related
In Visual Studio Code search specification I would like to combine directories and file kind specifications.
For example, I would like to search for particular string in all foo*.txt files under directory bar/var/extern. Another example: I would like to exclude from search directories out, tmp and files *.o.
Is it possible?
Example1:
Files to include: bar/var/extern/**/foo*.txt
This will include every single foo*.txt under bar/var/extern/ and it's subdirectories.
Example2:
Files to exclude: out, tmp, *.o
Reference: https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options
How do I global search in Visual Studio Code ( Search: Find in Files --> Ctrl+Shift+F in Windows ) for just a specific file type (e.g. *.js) AND in a specific path (e.g. ./src/app)?
I have tried using the following in the files to include field:
./src/app, *.js
but the comma separation query retrieves all the occurrences in either the path ./src/app or the file type *.js.
you have to write a glob pattern:
./src/app/**/*.js
Any directory (**) and only the JavaScript (*.js) files
For my website, I have one "root" folder with a bunch of subfolders containing many different types of files. Example:
root folder
subfolder
subfolder
HTML file
other files...
subfolder
HTML file
other files...
Many of these subfolders have HTML files in them. I am wondering if there are any commands I can run to open all of the HTML files in vscode, or of any filetype for that matter.
I am aware that cmd+control+p allows the selection of a specific file by search, but is there any modification of that for all files of a file type? It is probably possible to write a bash script to do this, but I am not well versed in bash and I am wondering if there are any built-in ways to do this on vscode or plugins I can install to do this.
It also should be noted I am on a mac.
Here's on option to find all files that match a given filename specification (in*.html in my example) and send that list of files to VS Code via xargs:
find . -iname "in*\.html" -print0 | xargs -0 code
My workspace directory contains package.json with some scripts and two subdirectories containing few other package.json files that I want to exclude from Script Explorer. Call them adir, bdir.
But any string I put in npm.exclude seems to simply reorder the visible entries in Script Explorer.
I tried first to exclude only one directory with "adir", "adir/**/*" but the directory is always present. Better results with "**/*" that excludes all subdirectories but leaves in Script Explorer only the first script from the workplace package.json file.
Worse if I try to exclude both subdirectories using "{adir,bdir}/**/*" or "[ab]dir/**/*" that seems to do nothing.
Also changing npm.exclude to an array of strings do nothing.
I run latest VSC on Windows 10 64 bits.
What I'm missing?
Thanks!
mario
Is there a way to search for ALL .txt files in a project and automatically replace/rename them to .js?
E.g user.txt to user.js
It seems I can't search for a file format in VS Code.
If you know how, please share!
You could just do it in the terminal.
mv *.txt *.js
You can use a combination of:
Filtering the EXPLORER panel to just show .txt files
See "Filtering the document tree" section of the VS Code docs
See related Stack Overflow post: "Filter files shown in Visual Studio Code"
Installing and using the Batch Rename extension
For example, given these files/folders:
Steps:
Start by clicking on the EXPLORER panel and filtering to just display .txt files
Select/highlight all the files, then right-click on any selected file, then select "Batch Rename"
That would open a text file ".Batch Rename.txt" with all the selected files
Do a regular find-and-replace to change .txt to .js
Note that the ".Batch Rename.txt" is unsaved. It's like a preview of what the changes would look like
Save ".Batch Rename.txt" and it will automatically close
The EXPLORER panel should now be empty since it's filtered on .txt
Remove the filter and the files should now be renamed
You can use find to do this in a terminal recursively.
find . -iname "*.txt" -exec rename .txt .js '{}' \;
refer Find multiple files and rename them in Linux
mv works if you want to just do it in a folder itself.
Old question, I know, but for you or anyone else coming in, if you're okay with using a non-VS Code solution, there's a GUI Windows tool called RegexRenamer that is so well-named, you already know what it does.
It gives you a preview of what the renamed files will look like, and has options to rename everything in subfolders or only the current folder, ignore/include file extensions in the search, and apply the rename only to folders/files or both.
What do you think?