1

I'm using Windows Subsystem for Linux 1 (WSL1), I want to rename the folder my code downloads files to from 'resources' to 'downloads' so I can group my files that do the downloading under a 'resources' folder.

I've tried to do git mv resources downloads and just mv resources downloads, but neither worked:

user:~/ponder$ git mv resources downloads
fatal: source directory is empty, source=resources, destination=downloads

Which I presume is because it the folder is git ignored (so no question here).

But...

user:~/ponder$ mv resources downloads
mv: cannot move 'resources' to 'downloads': Permission denied

But it should have all the available permissions

drwxrwxrwx 1 user user 512 Nov 7 11:56 resources

If I try:

user:~/ponder$ rename resources downloads
Bareword "resources" not allowed while "strict subs" in use at (user-supplied code).

But if I follow this Q&A I get this:

user:~/ponder$ rename  's/resources/downloads/' */
Can't rename resources/ downloads/: Permission denied

Even if I run chmod -R a+xrw resources, and check all permissions with tree -pug -L 2 -I node_modules, they are set like so:

├── [drwxrwxrwx user  user ]  resources
│   ├── [-rwxrwxrwx user  user ]  AllPrintings.json.gz
│   ├── [-rwxrwxrwx user  user ]  data_AllPrintings.json
│   └── [-rwxrwxrwx user  user ]  meta_AllPrintings.json

And here's ls -l ~/ponder:

:~/ponder$ ls -l ~/ponder 
total 928
-rw-rw-rw- 1 user user  35149 May  7  2020 LICENSE
-rw-rw-rw- 1 user user   2587 Jul 21  2020 README.md
-rw-r--r-- 1 user user    785 Aug  7 08:34 constraints.js
-rw-r--r-- 1 user user    736 Aug  7 08:34 constraints.spec.js
-rw-r--r-- 1 user user   1074 Aug  7 08:34 csvToJson.js
-rw-r--r-- 1 user user    631 Aug  7 08:34 csvToJson.spec.js
drwxrwxrwx 1 user user    512 Aug  7 08:21 dist
-rw-r--r-- 1 user user    724 Aug  7 08:34 entries.js
-rw-r--r-- 1 user user   1127 Aug  7 08:34 entries.spec.js
-rw-r--r-- 1 user user   3135 Nov 19 20:23 index.js
-rw-r--r-- 1 user user     88 Nov 19 20:23 jest.config.js
-rw-r--r-- 1 user user    192 Sep 12 01:06 jsconfig.json
drwxr-xr-x 1 user user    512 Sep 13 02:21 node_modules
-rw-r--r-- 1 user user 813408 Nov 19 20:23 package-lock.json
-rw-r--r-- 1 user user    893 Nov 19 20:23 package.json
-rw-r--r-- 1 user user    510 Aug  7 08:34 resource.util.js
drwxrwxrwx 1 user user    512 Nov  7 11:56 resources
-rw-r--r-- 1 user user   3213 Nov 19 20:23 resources.js
-rw-r--r-- 1 user user   3040 Nov 19 21:51 resources.spec.js
-rw-rw-rw- 1 user user   8561 May  7  2020 sample_data.csv
-rw-r--r-- 1 user user    182 Aug  7 08:34 webpack.config.js

I still get permission denied:

user@WIN-JJ73ICCH7S6:~/ponder$ rename  's/resources/downloads/' */ 
Can't rename resources/ downloads/: Permission denied
user@WIN-JJ73ICCH7S6:~/ponder$ mv resources  downloads
mv: cannot move 'resources' to 'downloads': Permission denied

Which I don't understand? Why can't I rename or move this folder?

AncientSwordRage
  • 1,714
  • 1
  • 20
  • 26
  • 1
    I'm taking bets this has to do with your operating system? Is that windows, and this is WSL2, by any chance? (such info is always appreciated to be prominently available in your question as well as in tags) – Marcus Müller Nov 21 '21 at 11:39
  • Is there already a directory named `downloads` present? Can you show us the output of `ls -l ~/ponder`? – terdon Nov 21 '21 at 11:42
  • @terdon not that I know of, `ls -l` output added – AncientSwordRage Nov 21 '21 at 11:49
  • @MarcusMüller it slipped my mind, and I almost thought there wasn't a tag as there's no synonym for [tag:wsl] -> [tag:windows-subsystem-for-linux] – AncientSwordRage Nov 21 '21 at 11:50
  • Could it be this?https://unix.stackexchange.com/q/352819/13107 if so when I've checked, can we close mine as a duplicate so searchers find my question, they're funnelled into the answer? – AncientSwordRage Nov 21 '21 at 11:56
  • Huh, maybe. Can you check if something is accessing `resources`? I have no idea how to do this on Windows, but try `sudo lsof resources` and see if you get any results. Also, you can create a file in `~/ponder`, right? Something like `echo foo > ~/ponder/somefile` works? – terdon Nov 21 '21 at 12:06
  • @terdon I'm doing this all inside of vscode, so I'm pretty sure it's locking the permission somehow – AncientSwordRage Nov 21 '21 at 12:07
  • Ah! Then yes, please add that to your question it is very pertinent. If you can confirm that closing VScode allows you to successfully run the `mv` command manually from a terminal, we can call it a dupe. Or, since the dupe is very old and was off topic at the time, maybe you could post a simple answer confirming it and we have a new dupe target? – terdon Nov 21 '21 at 12:08

0 Answers0