Can I move files from entire volume to a single folder. Like I'm working on c++ now a days and I have more than 300 *.cpp files in my 80GB partition(including folders and subfolders). I want to gather them at one place. is there any shortcut way to do that?
using cmd
move *.cpp "new folder"
This CMD method is only to move from one folder to another.
I got a way myself.
I enabled the "Show hidden extensions" from the folder options,then searched for .cpp. then Selected all of them by pressing Ctrl+A . After that I pressed Ctrl+x then pasted them in a new folder.
Related
Usually when I type cd in my terminal, it will return $
and if i type cd any file, it will turn to filename/ $
but now, it keeps on saying the file does not exist when the file does seem to exist.. how do i get it to work as per normal?
enter image description here
and if i type cd any file, it will turn to filename/ $
but now, it keeps on saying the file does not exist when the file does seem to exist..
Looks like you are in an other directory then you want to be. cd is working it just doesn't find your folder because it is in another folder/directory that you are currently in. If that's the case try one of the following:
on the left at you files go to "birthdays"-folder make right-click and say "open in Terminal". Your terminal should have the correct folder then.
type "ls" if you are in the wrong folder or don't see your folders do "cd .." this will get you to the next folder up in the hierarchy. Then do "ls" again and try to find a way to your Project folder.
Close VScode completely and open it using the VScode shortcut on your desktop(or somewhere else) then open your project using the open folder function. It should have the right folder selected then.
I want to open all files under /var/log/my_program/ in my current open workspace. To be clear, I want to open the files from this directory while keeping the files that are already open in my current workspace open as well.
e.g. if I have ~/hello-world.html open, I would like to open /var/log/my_program/error.log and /var/log/my_program/access.log in the workspace as well, having a total of 3 files open at the same time in the same window/workspace.
if I run code /var/log/my_program/* it will open up a new window with all of the files open from that directory. i.e. hello-world.html will be in one window and error.log and access.log will be in a new window
if I run code -r /var/log/my_program/* it will overwrite my current workspace with the files from that directory. i.e. hello-world.html will no longer be open in any window, and error.log and access.log will be open in my original workspace window.
I want to be able to keep the state of my current workspace AND open the files from the /var/log/my_program/ directory. i.e. I would like hello-world.html to stay open in the workspace AND have error.log and access.log open as well.
I would like to add that this is just a simplified example of what I am trying to do. I understand it would be easy enough to just open these two files easily in the command line, but the actual files in the dir I want to open could be several and all with timestamps in their names, so I cant easily open them by name
Is this possible? Thanks for any help!
EDIT:
I am really looking for a solution using the CLI. I am running a command similar to rm /var/log/my_program/*; systemctl restart my_program; code /var/log/my_program/*. This is so the dir doesnt get full of old log files, and I can see the new log files opened after I have restarted the process for my_program
The reasoning for all of this is to make my debugging routine less cumbersome, e.g. without mouse clicks or gui interaction
In VS CODE itself there is a keyboard shortcut that might be helpful:
ctrl + r
Which will open a drop down of folders.
Once you arrow down/up to the desired folder, you have two options:
Click enter to open the new folder instead of the current workspace, or
ctrl + enter to open a new folder in addition to the current open workspace
If I understand what you are trying to do correctly, you want to use the --add argument. You can run code --reuse-window --add <path> to open the folder at <path> in the current workspace. The shortened version would be code -r -a <path>.
In the visual studio code, it has commands to Copy Path and Copy Relative Path (Ctrl+Shift+p->File: Copy Path of Active File). Is there a way I could copy the active file name instead of the whole path?
If there is no way copy the active file name. Is there a way I could write a script or something which creating a new command based on existing Copy Path and showing the new command in the Command Palette?
The extension Copy file name works like a charm!
CTRL+ALT+F gives you filename and CTRL+ALT+E gives the filename.extension.
open your file on vscode> select file as active file> Ctrl+Shift+P > Alt+Shift+C
now you can use Ctrl+V to paste this path any where you want.
step1. first install "copy file name" extension from extensions(ctrl+shift+X) in your vscode.
step2. then use ctrl+alt+e for copying the full file_name with file_extension(like .cpp or .py or .java etc..).
or ctrl+alt+f for for copying the file_name
without file_extension.
It is been a while but I found if you want to write a script using the currently opened file, create a new task in task.json and calling some scripts in the task might be a good option.
Basically, ${file}, ${fileBasename} and ${fileDirname} are the variables that can be used in your script file.
Useful reference:
https://code.visualstudio.com/docs/editor/variables-reference
As an alternative, if you see the active file in the "Explorer" view, you can type F2 once you select it.
With VSCode 1.71 (Aug. 2022), you can type F2 and:
1st press => prefix
2nd press => all
3rd press => suffix
4th press => cycles back around to prefix
This has been release to VSCode insider today, for you to test/play with it.
Without using any extensions, here's a combination of key shortcuts you can use to copy the path of the current file. It's a bit cumbersome but with some practice can be faster than doing the same using the mouse.
Ctrl+Shift+E to open and focus the Explorer pane.
The current file will be selected automatically by default.
F2 to start renaming the file.
This will select the file name without file extension.
(optional) Ctrl+A to include the file extension in the selection.
Ctrl+C to copy.
Escape to abort renaming (or just click anywhere).
no need any extensions, Ctrl+K --> Ctrl+Shift+C, then you will get relative path
Is it possible to have VSCode always have a particular folder ("Directory A") open, so the files inside can be searched using Ctrl + P?
It seems the standard behaviour is that my current "added folder" (i.e. "Directory A") get removed whenever I open a file from a different location ("Directory B").
Closing VSCode and re-opening it always returns me to the last used file (i.e. opening "Directory B" and NOT "Directory A").
How can I force VSCode to always have a certain folder open please?
NB, I've looked into "workspaces" but this doesn't help as whenever opening a file not in the workspace, it seems to close the workspace.
Add Directory A to your workspace using File > Add Folder to Workspace...
Then rather than opening Directory B when you launch VSCode, open the .vscode-workspace file for the workspace that contains both directories.
If there are multiple files in your workspace which match the filename you're searching for using CTRL+P, all the matching files will show up.
The solution, at least on linux, is to create a script with the following content (let's call the script code-standard-path ):
#!/bin/bash
code /path/to/standardDir-or-standardworkspace "$1"
Then from caja right click on a file : open with -> other application.
Then select the command code-standard-path and check Remember this application for "..." files.
Now everytime you double-click on the specific file from whatever location, vscode will open in that predefined directory or workspace.
You can move a bit further and pass the standard path as first argument to the script (e.g. use code "$1" "$2"). So on the open with menu you provide each time the script like this: code-standard-path /path/to/standardDir-or-standardworkspace.
This gives you the ability to open a differrent standard path depending on the file you open (e.g. for .c, .java, .html)
Had the same issue. But there is an easy fix:
On the menu bar go to file File > Preferences > Settings > Window and under Restore Windows select the option preserve.
This will ALWAYS reopen the last session, no matter if you start VS from shell, desktop shortcut or by opening a file.
Open settings File > Preferences > Settings Or by clicking (ctrl + comma)
Type "include" in search bar
Find "Search > Quick Open: Include History"
Uncheck the option
Is there any possibility to create exe file which copies path of a file into clipboard when you drag&dropp the file into the exe? How could I do it ?
Thanks
Two ways OTM in Windows:
1. Start > Run
2. Start > Run > "cmd"
in both cases, once you drag the file onto the window, its entire path will be pasted.
To do the copy, you'll have to do that manually (easier in the Run window)
To do this onto an application:
How do I drag and drop files into an application?
A just found a program called Copy Path that works for me. It adds "Copy path" to the Windows Explorer context menu (not exactly drag-and-drop, I know).