rm

Unable to remove files recursively from Git

牧云@^-^@ 提交于 2019-12-02 17:40:02
I want to remove all files from Git at ~/bin/. I run git rm -r --cached ~/.vim/* # Thanks to Pate in finding --cached! I get fatal: pathspec '.vim/colors' did not match any files This error messsage suggests me to use the following PATHs, since ~/.vim/** does not work ~/.vim/* # I get the error ~/.vim/*/*/* # This removes files from the index at ~/.vim/folderA/folderB/file1.txt ~/.vim/*/* # similar error as to the first PATH How can you remove all files and subdirectories at ~/.vim from Git? -- git rm -r --cached ~/.vim/* fatal: pathspec '.vim/colors' did not match any files 1/ You do not need

Removing a file called ~ [closed]

半世苍凉 提交于 2019-12-02 03:46:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I accidentally named a file ~ when I was trying to move it to my home directory. And now in my / there is a file called ~ and I have no idea how I would remove it. How would I remove a file that I accidentally renamed ~ ? 回答1: Put the filename in quotes: rm '~' You can follow the bash manual: https://www.gnu.org

rm() doesn't seem to empty my R workspace

雨燕双飞 提交于 2019-12-02 02:31:04
问题 I'm trying to clear my R workspace. Nothing I've found in any thread seems to work - and I've been googling and trying solutions for hours now :( When I open R and type ls , the console displays all the code from a previous session: function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE, pattern) { if (!missing(name)) { nameValue <- try(name, silent = TRUE) if (identical(class(nameValue), "try-error")) { name <- substitute(name) if (!is.character(name)) name <- deparse(name

Removing a file called ~ [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 01:11:39
I accidentally named a file ~ when I was trying to move it to my home directory. And now in my / there is a file called ~ and I have no idea how I would remove it. How would I remove a file that I accidentally renamed ~ ? Put the filename in quotes: rm '~' You can follow the bash manual: https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html If a word begins with an unquoted tilde character (‘~’), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. ... You could just use a backslash to remove it

Restore deleted file not staged in git

廉价感情. 提交于 2019-12-01 03:21:00
I accidentally removed the entire directory of my source code...with a nice rm -r. I know, really bad; but fortunately, I had a git repo in the containing directory. Thus, git has a huge list of unstaged changes of deleted files. For example: "deleted: src/caronmonitor/server.py" How do I get these files back? There is advice all over the web to do: git checkout file or git revert <commit> But as I understand that will restore the file to it's state at the last commit. I don't want to go back to the last commit but instead go back to right before the delete operation. I can look in the gitk

Bash script to remove all files and directories except specific ones

懵懂的女人 提交于 2019-11-30 18:34:14
I am trying to write a very simple Bash shell script that will cd in a specific directory, it will remove all files and directories except some few selected ones and then cd back to the original dir. My code is: #!/bin/bash cd /path/to/desired/directory shopt -s extglob rm !\(filename1\|filename2\|filename3\) -rf cd - I have tried many different ways to write the symbols '(' and '|', with single or double quotes or backslash but nothing worked. Note, that shopt -s extglob and rm !(filename1|filename2) -rf work fine outside a script. Probably I am committing a standard and fundamental bash

Delete files with string found in file - linux cli

江枫思渺然 提交于 2019-11-30 10:16:48
问题 I am trying to delete erroneous emails based on finding the email address in the file via Linux CLI. I can get the files with find . | xargs grep -l email@domain.com But I cannot figure out how to delete them from there as the following code doesn't work. rm -f | xargs find . | xargs grep -l email@domain.com Thank you for your assistance. 回答1: For safety I normally pipe the output from find to something like awk and create a batch file with each line being "rm filename" That way you can check

Bash script to remove all files and directories except specific ones

时光怂恿深爱的人放手 提交于 2019-11-30 03:17:26
问题 I am trying to write a very simple Bash shell script that will cd in a specific directory, it will remove all files and directories except some few selected ones and then cd back to the original dir. My code is: #!/bin/bash cd /path/to/desired/directory shopt -s extglob rm !\(filename1\|filename2\|filename3\) -rf cd - I have tried many different ways to write the symbols '(' and '|', with single or double quotes or backslash but nothing worked. Note, that shopt -s extglob and rm !(filename1

How to avoid “No such file or directory” Error for `make clean` Makefile target

前提是你 提交于 2019-11-30 02:44:42
问题 I have a Makefile that defines a .PHONY clean target for cleaning up .o files and executables, that target looks like: ... .PHONY : clean clean: rm $(addprefix $(vq_DIR),$(vq_OBJS)) \ $(addprefix $(vq_DIR),vq) \ $(addprefix $(covq_DIR),$(covq_OBJS)) \ $(addprefix $(covq_DIR),covq) \ $(addprefix $(covq_2_DIR),$(covq_2_OBJS)) \ $(addprefix $(covq_2_DIR),covq_2) \ $(addprefix $(covq_2_DIR),$(test_OBJS)) \ $(addprefix $(covq_2_DIR),test) Everything works as it should, but when some of these files

git - how to remove empty folder and push that change?

只愿长相守 提交于 2019-11-29 21:12:46
How can I remove an empty folder locally and also have that happen for other collaborators that share the remote via pull-push? I know that folders aren't 'tracked' in that sense by git but the question remains. e.g. I moved a file to another folder and committed the change (of the move). But I can't git rm name the folder as I get "doesn't match" git rmdir name doesn't exist. I can do a git clean -f folder but how does that get pushed up? I can directly rm the file but how do I get that directory removal done correctly and pushed to the repository and then out to others when they pull so that