1

I am making a website for my online book/media business, and I have some photos on my C drive (cover photos) that I would like to copy into my project directory in VSCode via WSL.

The file is stored in /mnt/c/Users/etc/Downloads. As I would still need to have this folder in C, I probably would just need to copy the contents of the folder and move it to an already made directory in my WSL project.

I have tried to make a directory in my WSL project via WSL with mkdir and then copy the contents of the file when I am on the path /mnt/c via cp. I have tried to move it into the folder in WSL with mv but it has not worked.

I have been at this for over a week now with no success. I have tried to find YouTube videos on it, and I have tried to get books on git from the library. Either the really good books are checked out, or the books I have do not address this issue.

So, for example, I would make a directory in my current VSC project via WSL with mkdir bookphotos. Then I would use the terminal to go to the mnt/c/Users/ path until I found my folder with my cover photos. I would then try to copy that folder with cp and move it to the WSL directory. It has not worked. Some help would be appreciated.

The full path to the folder is /mnt/c/Users/warriors/bookphotos when I am in the Ubuntu/WSL terminal. The project in VSC that I would like to move the folder into is /home/sixwarriors/booksbusiness - that is the directory where I have my html/css/javascript code. I would like to copy the bookphotos folder and move it into the booksbusiness directory so that I can use the stock photos on there.

10
  • What are the full path of the source and destination folders as seen from WSL? Add this information in your question.
    – user68186
    Apr 15, 2022 at 19:35
  • Thank you for the response. I updated the question with the paths.
    – jumpman23
    Apr 15, 2022 at 19:48
  • Do you mean the source is: /mnt/c/Users/warriors/bookphotos? Note file and folder names are case sensitive in Ubuntu.
    – user68186
    Apr 15, 2022 at 20:33
  • 1
    So to copy a folder the syntax needs to be cp -r /path/to/source /path/to/destination. If you're copying to a path that needs elevated write permissions, you need to start the command with sudo
    – Nmath
    Apr 15, 2022 at 22:23
  • 1
    Feel free to accept my answer as correct by clicking on the gray check mark ✓ next to the answer and turn it green ✅. This will mark the problem as solved and help others find the correct answer.
    – user68186
    Apr 15, 2022 at 22:34

1 Answer 1

2

To copy, try:

In WSL try the command:

cp -r /mnt/c/Users/warriors/bookphotos/ /home/sixwarriors/booksbusiness/

To move, try:

mv /mnt/c/Users/warriors/bookphotos/ /home/sixwarriors/booksbusiness/

In both cases you should have bookphotos folder inside the bookbusiness folder with all it's contents.

Try it from the Windows side

In the Ubuntu/WSL terminal enter:

cd ~/bookbusiness
explorer.exe . 

This will open the bookbusiness folder File explorer. Now you can drag and drop the bookphotos folder inside the bookbusiness folder.

Alternately...

Open File Explorer in Windows the usual way:

enter image description here

Then at the top type:

\\wsl$\Ubuntu\home\sixwarriors\booksbusiness

This will also open the bookbusiness folder File explorer. Now you can drag and drop the bookphotos folder inside the bookbusiness folder.

Hope this helps

3
  • Thank you for the answer! I tried tried the explorer method before but I kept trying to extract the files into the book directory in WSL but obviously it wasn't going to find that path. I didn't know that I could just drag the folder but I actually just did it. Thank you! And thanks for the command showing me how to move the directory. For some reason, I wasn't putting the entire path. I thought if I jut put the name of the directory it would move it there. That is where I went wrong. I need to study Git a lot more. Thank you for your time; you are appreciated!
    – jumpman23
    Apr 15, 2022 at 22:17
  • @jumpman23 Just a heads-up that none of this has anything to do with Git. :-). What will help is learning the shell, specifically the Bash shell (not to be confused with "Git Bash", a separate Windows program). There are a lot of resources out there. You might start with this Microsoft (believe it or not) tutorial. Best of luck! Apr 15, 2022 at 23:10
  • @NotTheDr01ds hmm that's interesting. I have been learning Git and using that inside the shell; I thought the git commands would be the same as those that would be used in the bash shell. I have always just looked at git and used those commands to work inside the shell. Well, maybe because I am using git to help develop my webpage and other computer programs. That is why I thought that. But as you stated I am sure that learning the shell would help a lot. And if I ever chose not to use git I would still know how to operate the Bash shell. Thanks for the help! I am studying the link.
    – jumpman23
    Apr 15, 2022 at 23:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .