So I learned in programming, we can copy a reference by passing it to a variable. Can we do something similar for reference to files and folder in Windows, if so how? (It will be reallyyy nice if I can edit the same file but from 2 different locations on the same computer)
In the Command Prompt, you can use mklink to create soft or hard link, for directories:
mklink /D <the link> <original/target dir> to create a soft link/symbolic link (to learn more)
Or
mklink /J <the link> <original/target dir> to create a hard link/junction (to learn more)
Related
I have multiple files' directories and i need to copy them into specific folder using terminal, how do i do it. I also have access to GUI of the system, as all this is being done in virtual machine using ssh
According to its manpage, cp is capable of copying various source files to one output directory.
The syntax is as follows:
cp /dir1/file1 /dir1/file2 /dir2/file1_2 /outputdir/
Using this command, you can copy files from multiple directories (/dir1/ and /dir2/ in this example) to one output directory (/outputdir/).
I'm currently running the scrip located on Google Drive file stream from the Spyder IDE with no problem, but looking for a run from anaconda promt. When I try:
cd G:\My Drive\LBTC API\V0.2
It doesn't do anything at all, I got the same result if I try:
cd G:\
Thanks
The cd command (or chdir) changes the current directory of the given drive, but does not change the current drive:
rem /* This changes the current directory of drive `G:` to `\My Drive\LBTC API\V0.2`,
rem but if you are on another drive, say `C:`, you will not notice a change: */
cd "G:\My Drive\LBTC API\V0.2"
rem // When you change to the drive `G:` you will see the effect of the `cd` command:
G:
To change the drive as well as you must specify the /D option:
rem // This changes to the drive `G:` and changes its current directory:
cd /D "G:\My Drive\LBTC API\V0.2"
Actually the quotation marks around the path is not needed for the cd command, but I tend to use them also here as they do not harm, and they are needed for paths in many other situations.
First you change to the virtual drive and then you change the directory:
$ G:
$ cd /My Drive/LBTC API/V0.2
That should work fine, hope it helps
I'm trying to copy images in a directory using Python 2.7.12. The problem is that I want to only move the files within the Directory and not the Directory.
So in bash it would look something like
cp /path/to/source/* . /path/to/destination
but I want to do this in Python 2.7.12. I know how to copy the directory using things like shutil.copy but you can't add the /* to move the files within the directory. I'm kind of new to python and Stack Overflow so I'm sorry if there is any errors or confusion.
You could just use cmd terminal if your a windows user.
Type in help Robocopy and it should display different options
Into the folder /usr/local/var I would like to create a symbolic link run that point to /var/run folder. But I'm quite bit confused how to correctly create the link. Should I create initially the run folder?
You can create it like this without the need of creating something before:
ln -s /usr/local/var /var/run
If you are windows users and want to create a symbolic link of a folder is here how:
NOTE: Just make sure you run the command prompt as administrator.
WINDOWS
mklink /d "D:\site\abc\js" "F:\xyz\js"
MAC
ln -s /usr/local/var /var/run
How would I change to the directory C:/Users/myname/project name in Git Bash?
cd /c/users/myname/project\ name
Beware that ls /, or typing cd / followed by Tab-completion, might not show the existence of this folder, but cd /c will still work. Also note that pwd (to print the current working directory) might show something like /bin, but this might not be the actual working folder for commands such as git clone, which might use the folder from which Git Bash was started.
If the you know how many levels up from your current working directory, you could use cd ../project/name to avoid writing the entire directory path.
The .. represents moving 1 directory up.
You will need to use quotes in your directory name, or the short version of the filename.
You can find the short version of the file name by issuing the command:
dir /x
If I remember correctly. I do not have a windows machine.
It is a version of bash shell though, so you should be able to simply quote it. (And the dir /x may or may not work.)
If you are at the a directory and wanna switch to sub directory use :
cd "project name"
If you wanna go to a different path use the whole path :
cd "C:/Users/myname/project name"
But you can avoid use white spaces in project files and folders and instead use underscore
An alternative that worked for me (Windows 10 x64) is putting the full address in quotes:
cd "D:\BWayne\Documents\- School\Developer\-- Backend\Test for GitBash"
I could then do like mkdir, touch, etc and it successfully put them in the Test for GitBash folder.