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?
Related
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
I am not able to find checkout option for a file when I right click on it in ClearCase explorer while the option is available for rest of the files.
The only difference is that the file I want to check in has a very long name ( I am using Windows ).
While I am able to check in via cleartool commands, it isn't possible from front end ( CC explorer) Is there any way to check out such files from CC explorer?
There are two possible causes for a checkout unavailable:
the path of the file itself is too long (combined with the long filename, more than 256 characters): a subst command can help shorten the path.
or the file is already checked out.
A cleartool status can help distinguish between those two cases.
And a cleartool lsvtree -graph aFile (replace aFile with your long filename) can help see the file history and see if it is checked out (reserved or not) in another view.
The window 255 characters restriction for file name can't be bypass or any sidestep if it.
You have the following options:
1. Try to shorten the name. Including all the folders that are the prefix for the view. Like vonC suggested.
2. Try create the view on Linux, and mount the folder to some shared area that can be seen in windows.
3. Use dynamic view, but Im not sure it will work.
Keep in mind, that other apps can also fail even after you solve it for clearcase as it is a Windows problem. Like msbuild or visual studio.
In our ansible role ,there is a main file which calls tasks from multiple files.
One of the sample task is given below
- name: Delete folder
include_tasks: folder_delete.yml
vars:
folder: "{{folder_name}}"
If i need to go to the file folder_delete.yml thne currently i am copying the file name folder_delete then use Ctrl+p then in it i am copying and open the file.
In other languages , If we click on function and click f12 ,it will go to definition. Like that in ansible extension ,is there any way to go to the file by using some shortcut? I am opening files many times, a shortcut will be a great help
Or is there a way to write that in some macro ?
I found an answer by myself but recording it for future user.
I used the Openfileatcursor extension . I select the file and type alt+d then it shows it in quick open. From there i am able to open it. This helps me a lot.
Also another extension named Openfile . This is even more useful, I have to select the file name and type Alt+p it will open the file
I am using
chmcmd, a CHM compiler. (c) 2010 Free Pascal core.
for generating .chm file from Doxygen output. It presents me with error messages like
Warning: Found file dynsections.js while scanning files.html, but couldn't find it on disk
and similar for "namespacestd.html". It looks like something has changed in the installation of Doxygen during the times. It is just a warning, but I guess it has reason and consequences. How can I overcome it?
I don't use ChmCmd but even with Doxygen version 1.8.13 the file dynsections.js is always contained in the output directory ..\html on my Windows10 machine.
Of course I have <script type="text/javascript" src="dynsections.js"></script> in files.html.
Please first search for the files like dynsections.js. Try adding the names of the *.js files to the [FILES] list in your project (.hhp) file. This will ensure that the .js files are compiled into the help file, which may not be the case at present.
If you're using HTML Help Workshop as an alternative to chmcmd, the procedure for adding the file names to the [FILES] section is as follows:
Open the .hhp file in HTML Help Workshop.
Click the Add/Remove Topic Files button on the Project tab.
Click Add.
In the File Name field, type *.js.
Click Open, select the files to add to the list, and then click Open again.
You can go the short way by editing your *.hhp file with a text editor. Add a new wildcard line for all *.js files in the [FILES] section like:
[FILES]
dynsections.js
jquery.js
menu.js
menudata.js
design.css
...
Given the file tree:
x/y/a.txt
How do I move the file up to:
x/a.txt
When right clicking on the file I just see delete and rename but not the move command.
A google search did not reveal anything about this.
I use vscode 1.6.1
Update: It is currently impossible to move files and folders to the root folder: https://github.com/Microsoft/vscode/issues/1043
Move is available by right-clicking the file in the sidebar after installing File Utils from the Visual Studio Code Marketplace.
You can use drag n' drop to move the file
You can also move file with using console (for example PowerShell or Git Bash) in Code.
Recently I have I habit to move files or folders in sidebar, via ctrl + x (cut) and ctrl + v (paste), after this action Code automatically updates imports.
Drag & drop method also works.
The OP issue 1043 which was resolved with VSCode v1.37 (2019)
That feature is still improving, with issue 98309: "Support multiple files in working copy file service".
See PR 98988 "File operation events support multiple resources"
That allows other files which depends on the move to be properly updated when you are moving several files.
That will avoid this: