0

I am currently learning how to use the bash hyper terminal on windows. All commands seem to work correctly e.g mkdir, touch, cd; but when trying to use rm to remove a file I get the message: "rm: cannot remove 'text.txt': permission denied.

I have alredy tried running the terminal as admin, deactivate the UAC; none worked. I am currently using the lastest version of gitbash an using "Hyper" as my terminal. In the folowing code i first created a folder called mike, which was then used to have the document text.txt (this document was made with the "touch" command). Then when trying to delete it, i get permission denied. These are the commands I used. I have already tried running the terminal as admin and disable the UAC, none worked. help would be very much appreciated :)


mikep@Turing MINGW64 ~
$ cd OneDrive/Documentos/WebDevelopment/

mikep@Turing MINGW64 ~/OneDrive/Documentos/WebDevelopment
$ mkdir mike

mikep@Turing MINGW64 ~/OneDrive/Documentos/WebDevelopment
$ cd mike/

mikep@Turing MINGW64 ~/OneDrive/Documentos/WebDevelopment/mike
$ pwd
/c/Users/mikep/OneDrive/Documentos/WebDevelopment/mike

mikep@Turing MINGW64 ~/OneDrive/Documentos/WebDevelopment/mike
$ touch text.txt

mikep@Turing MINGW64 ~/OneDrive/Documentos/WebDevelopment/mike
$ rm text.txt
rm: cannot remove 'text.txt': Permission denied

mikep@Turing MINGW64 ~/OneDrive/Documentos/WebDevelopment/mike
$ sudo text.txt
bash: sudo: command not found

mikep@Turing MINGW64 ~/OneDrive/Documentos/WebDevelopment/mike
$
4
  • 1
    (1) Show the output of "ls -la" (2) Check whether same Issue occurs with New Directory mike/X & with new file mike/text2.txt (3) Is your OneDrive connected (& synced) to the Cloud Account ? (4) Check whether Issue occurs outside this Directory , eg in ~/My-Drive/CHECK/text.txt !
    – Prem
    Commented Jul 14, 2022 at 7:43
  • It is obviously OneDrive Issue ; It will not occur outside your OneDrive Directory. You should use Windows GUI to Configure OneDrive & Delete these Contents. You can try experimenting with Bash & rm outside OneDrive , eg in ~/My-Drive/CHECK/ where Bash & rm will work with no Issue !!
    – Prem
    Commented Jul 14, 2022 at 14:58
  • 1
    @Prem GOD THANKS, YOU SAVED ME!!! Commented Jul 14, 2022 at 20:50
  • In the interest of Question&Answer Communities, you should consider Accepting the Answer if it was correct (& upvote if it was useful) to mark this Question Right !!
    – Prem
    Commented Jul 15, 2022 at 3:42

2 Answers 2

0

It is obviously OneDrive Issue ;
It will not occur outside your OneDrive Directory.

You should use Windows GUI to Configure OneDrive & Delete these Contents.
You can try experimenting with Bash & rm outside OneDrive , eg in ~/My-Drive/CHECK/ where Bash & rm will work with no Issue !!

The Core Issue is that OneDrive has locked these Contents and is not allowing the Deletion.

0

For me on Windows 11 it just works.Do you have WSL2 installed? Then go to: /mnt/c/users/user/OneDrive

You must log in to answer this question.

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