543 questions
-2
votes
0
answers
24
views
I cannot rm files on mac IOS 13.7.1 [closed]
I am using MacOS 13.7.1 (22H221).
I want to delete files from /usr/share/man, for example rm -vf /usr/share/man/man8/parsecd.8, but failed with error "Read-only file system".
I have tried:
...
0
votes
1
answer
64
views
Can't delete folder on Azure Persistent Storage
I am running an Azure App Service that deploys a container app. I enabled persistent storage so I can store some database data. The service is in the stopped state and now I wanted to remove the ...
0
votes
2
answers
38
views
rm command works in shell but not in Makefile
I have an rm command that does not work in a Makefile but when I copy it to the shell it works:
$ make clean
rm paper.{abs,blg,pdf,aux,log,bbl,out,xmpdata}
rm: cannot remove 'paper.{abs,blg,pdf,aux,...
0
votes
1
answer
146
views
unable to dwonload zip file from google drive using gdown method in vs code
manually downloading openpose models
%%bash
gdown 1QCSxJZpnWvM00hx49CJ2zky7PWGzpcEh
unzip models.zip
mv /content/models/face/pose_iter_116000.caffemodel /content/openpose/models/face/pose_iter_116000....
0
votes
1
answer
12
views
how to prevent exit 1 when blanket rm -R with empty directories
So I am deploying a script to remove several directories of a program we no longer use. It was such a cluster though that not all directories are present on the computers. I am doing a simple rm -R ...
-2
votes
2
answers
439
views
Is there any way I can use rm -rf in PowerShell?
I know that I can use rm -r -fo to remove a folder and all its content in PowerShell. But is there any way I can use rm -rf in PowerShell?
I tried to add the below scripts into my $Profile, but both ...
0
votes
1
answer
132
views
nodejs fs.rm(path, { recursive: true, force: true }) throws "ENOTEMPTY: directory not empty"
import { existsSync } from "fs";
import fs from "fs/promises";
export async function makeFolder(path: string) {
if (existsSync(path)) {
try {
await fs.rm(path, { recursive: true, ...
0
votes
1
answer
556
views
node js rimraf delete dist folder in any of the subfolders of src
I have many dist folders inside src folder. It can be nested at any depth.
src
- dist
- main
- dist
- com
- dist
....
- test
- dist
-...
0
votes
1
answer
315
views
rm: cannot remove `dir-name': Directory not empty [closed]
ls -al .vscode-server
# . .. bin
ls -al .vscode-server/bin
# . ..
I tried to use rm -rf .vscode-server to remove .vscode-server, and got rm: cannot remove 'dir-name': Directory not empty.
I tried ...
0
votes
0
answers
401
views
Deleting folders and files from s3 bucket based on last modified date column and based on name prefix using AWS CLI
I want to delete folders from aws s3 my-bucket which are older than 2023-05-01 and folder names which starts with "000". using AWS CLI
I can delete folders and files which starts with "...
0
votes
1
answer
57
views
Shell script - rm does not remove directory from variable set by external parameter
I would like to run a shell script test_shell.sh to delete a directory defined by a parameter set in another file test_config.txt.
test_config.txt:
var = testdir
test_shell.sh:
#!/bin/bash
vardel=$(...
0
votes
1
answer
299
views
Add-AzureRmVhd : Resource group 'ResourceGroupName' could not be found
I'm trying to import VHD via PowerShell in a Virtual Machine but am getting errors.
Add-AzureRmVhd : Resource group 'ResourceGroupName' could not be found.
At line:1 char:1
+ Add-AzureRmVhd -...
-1
votes
1
answer
41
views
How to remove special character filename in Linux?
I have a filename with -v. I try to remove it by
rm -v or rm "-v" or rm ¥-v
But it shows something like
rm: missing operand
Try 'rm --help' for more information.
1
vote
0
answers
161
views
Rightmove deliveryPointId does not match up with Royal Mail "CSV PAF.CSV" file
I have obtained a particular property's deliveryPointId from one of their pages. I then tried to match it up with its correct address from the PAF file but find that it matches a property in a ...
1
vote
1
answer
53
views
How to rename or remove file name with weird quotes and slashes in linux
When I run git status I get:
Untracked files:
(use "git add <file>..." to include in what will be committed)
"\231"
"\231\217\373\275\235Y"
So I ...
-1
votes
1
answer
32
views
Mac terminal directory issues
I previously had a bootcamp that I input labs in one folder but i made them all directories in my macOs terminal. I can't delete them. I tired to (rm -r) all but when I override them, they were all ...
0
votes
1
answer
62
views
Remove all files in *that* directory except *these* files - dangerous in remote directory?
I'm writing a small bash script for deploying a bunch of files to a specific remote directory. The process is as follows:
Mount remote directory (sshfs)
Remove everything except these few files
Copy ...
0
votes
1
answer
77
views
Aliasing the rm command to avoid evaluating separate asterisks
I would like to use the rm command such that it returns an error when there is a separate asterisk in its argument. For example, if I type rm -f * .txt , then this command should not be executed (this ...
0
votes
1
answer
89
views
failed to delete multiple folders inside one folder except 3 folders using rm
I am trying to delete all folders inside a folder except 2 3 using rm. But, command doesnt work with below error
Tried using escape character, but it will not delete folders.
Any solutions?
EDIT 1
...
3
votes
1
answer
91
views
Remove dirs from parent dir without deleting parent directory (Linux)
I am using the following command to remove all dirs older than 1 minute from the following path:
find /myhome/me/xyz/[0-9][0-9]/[0-9][0-9][0-9][0-9]/my_stats/ -mmin +1 -exec rm -rf {} \;
folder ...
0
votes
1
answer
27
views
How to avoid a directory from being removed [closed]
I wanted to know if there is a way to create a file inside a directory that avoids it to be removed by a simple rm -r, just like when we have a Git respository and it is not deleted because of the ....
0
votes
1
answer
205
views
Delete a file in a directory except for first file (or specific file) in Python
I want to delete all files in a directory except for one file in python.
I used os.remove and os.system(with rm and fine), but all of them return errors.
Lets say I have a folder X and in there I have ...
0
votes
0
answers
209
views
Remove only one specified directory recursively from a folder (Linux)
My question is pretty quick to explain, I don't know about the solution.
I have a folder always containing 3 folders that can themself contained others folder. I would like to be able to remove only a ...
-1
votes
1
answer
567
views
How to remove files with wildcard?
rm with wildcard is not working.
if there are files that named with ef1 & ef2 then, i tried to erase ef1 & ef2.
$ rm ef*
This could not erase ef1 & ef2.
But like as bellow, single file rm ...
0
votes
1
answer
147
views
How to delete an empty folder with 2 times . (dot) file and .. (dot dot) file?
On a qnap nas I have a folder that I cannot delete.
The folder is empty except for 4 directories: 2 times a . (dot) folder and 2 times a .. (dot dot) folder. To my knowledge this is not possible.
Does ...
1
vote
1
answer
447
views
Why doesn't rm() work on paste0() string?
I tried removing data from my environment using rm(paste0("namePart1", "namePart2")), but got the " ... must contain names or character strings" error. However, when I ...
0
votes
1
answer
299
views
rm not deleting files completely
I have written an alias to create makefile (basically copying a template makefile and substituting the final exec name) in any project dir:
This is my cpmk command:
alias cpmk='f() { ...
1
vote
1
answer
2k
views
Bash one-liner: check if a directory exists; if so, delete it, then create it anyway
I have to use bash -c, so i need something like bash -c "rm -r tmp/mydir1 && mkdir -p tmp/mydir1/mydir2"
but it does not work in this way.
-1
votes
1
answer
101
views
Do we have any command that HDFS rm/rmr command confirmation before removing the file?
If I call hdfs dfs -rm -r Filepath, the file/directory will delete instantly.
I want to know whether any command arguments is there which will ask for confirmation before rm the files?
0
votes
1
answer
95
views
Deleting directories with exceptions (in where to find)
I am working with Linux and I am trying to build a script to delete directories (pattern: dir.*) inside /tmp directory.
Inside /tmp directory I have something like this:
/tmp/dir.1
/tmp/dir.2
/tmp/dir....
-4
votes
1
answer
67
views
what happened if i rm a file without unstaging it?
lately, I've been learning git, then I came to the git rm that kind of confused me, I kept digging in and understood most of it, but there is a question still baffling me, what will happen if I ...
2
votes
1
answer
711
views
I accidentally deleted files in a repository using rm *$*
I was trying to remove a file within a repository which contained a "$" symbol, so I used:
rm *$*
But this deleted all my files in the directory and attempted to delete all subdirectories ...
0
votes
1
answer
229
views
delete all files except a pattern list file
I need to delete all the files in the current directory except a list of patterns that are described in a whitelist file (delete_whitelist.txt) like this:
(.*)dir1(/)?
(.*)dir2(/)?
(.*)dir2/ser1(/)?(.*...
2
votes
2
answers
2k
views
How can I delete all files in a folder, but not the folder itself, in zsh?
Unfortunately zsh: how to delete contents in folder without deleting the folder? does not have any good answer.
I'm currently using rm -rf {.,}* and if that fails because there is no hidden file in ...
1
vote
1
answer
1k
views
How do you remove an entire directory except for certain subdirectories in linux? [duplicate]
Suppose I run the following command in linux:
$ mkdir -p mp3 jpeg/dir1 jpeg/dir2 txt
$ touch mp3/1.mp3 mp3/2.mp3 mp3/3.mp3
$ touch jpeg/1.jpeg jpeg/2.jpeg jpeg/3.jpeg
$ touch txt/1.txt txt/2.txt txt/3....
1
vote
4
answers
3k
views
Recover deleted files from local git repo?
I accidentally rm'd some files in a git repo. Those files had been changed a lot and hadn't been git add'd yet.
Is there a way to restore the files to their 'last saved' state?
UPDATE
Just wanted to ...
0
votes
0
answers
53
views
Bash script to delete certain files from "semi-sequentially" numbered directories?
I have directories that are sequentially numbered 1001, 1002, 1003, etc... Some directories may not exist so we may see instances like 1001, 1002, 1003, 1007, 1008, etc... and I want to delete all ...
0
votes
0
answers
804
views
What does command rm -f -- would do?
I am trying to understand a command it runs this remove after -execdir flag.
find /a/directory type -f -execdir rm -f -- {} \;
I am trying to understand what the -- symbols after rm -f signify ?
11
votes
3
answers
66k
views
Automatically solve rm cannot remove path : device or resource busy error
I am trying to remove a directory /path/to/dir using the rm -rf command.
Unfortunately I get the error
rm: cannot remove '/path/to/dir/.nfsdda293a660f276ca0000000a': Device or resource busy
After a ...
0
votes
1
answer
256
views
bash: removing many files of the same extension [duplicate]
I am dealing with the folder consisted of many log filles. I have to remove all of them using bash. My version using rm does not work:
rm "${results}"/*.log
that gives me:
./dolche_vita.sh:...
0
votes
2
answers
1k
views
Cannot remove .git/: Directory not empty
I have a .git/ folder that I'd like to delete. However, it isn't possible because there is a puzzling file into it which is not reachable.
Below is my try:
$ rm -rf .git/
rm: cannot remove '.git/': ...
0
votes
2
answers
610
views
Command in dockerfile doesn't take effect
Below is my dockerfile. After the dependencies are installed, I want to delete a specific binary (ffmpeg) from the node_modules folder on the container, and then reinstall it using the install.js file ...
-3
votes
1
answer
12k
views
What does rm ** does in LINUX [closed]
what does rm ** do in linux.
started learning linux and stuck here.
I tried reading but couldnt understand or didn get the answer
-2
votes
1
answer
252
views
Deleting in a directory where other thread is writing in linux
In my code I am trying to delete a directory having files and subdirectories using rm -rf .
While deleting I am getting the error message , "Directory not empty". This is happening because ...
0
votes
0
answers
58
views
Lost previous commits and .git folder (all hashes lost) [duplicate]
TL;DR: I deleted the .git directory, recreated it with git init, then did a git commit, then did a git push using --force option and overwritten the remote repository with an empty one.
So as a total ...
0
votes
0
answers
310
views
Not able to remove a file
Am not able to delete a file called 'go' in my bash home directory. I tried rm -r go..it dint work.it showed permission denied.as am a beginner I really can't figure it out how such a directory was ...
0
votes
1
answer
2k
views
How to mass remove files that contain special characters in file name
Google Drive went a little crazy and create multiple iterations of files by appending multiples of "(1)", "(1) (1)" to the file names. So far I've been able to get a decent list ...
0
votes
1
answer
3k
views
I have problems with permissions using xargs with rm
I have remove.txt file containing a.txt and b.txt as text. All files are in the same folder, I set chmod 777 for all those files. Now, when I run sudo cat remove.txt | xargs rm I get Permission denied ...
0
votes
1
answer
56
views
How to drop object accoring the object's name [duplicate]
There are data.frame in R , I want to drop all of them whice name like 'table_*'.
rm(c('table_a','table_j','table_w','table_z')) seems can't work. Anyone can help ? Thanks
table_a <- data.frame(cat=...
0
votes
1
answer
471
views
nftw: remove the directory content without removing the top dir itself
I developed a function to recursively remove a directory with nftw():
#include <errno.h>
#include <string.h>
#include <ftw.h> /* for nftw() */
int unlink_cb(
const char *...