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 anyone know of a way to remove this folder? Thank you. About the nas: Answer fsck (file system
Tag: rm
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: How can I perform this in one bash line? Answer Any bash script can fit on one line: Check the output and then, if it’s OK:
What does rm ** does in LINUX [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
Deleting files after 7 days not working
I am trying to delete all files that are older than 7 days. The command is working but not correctly. It does delete files but it’s not accurate. The find does delete files, but when I run the ls command does contain files that should be deleted. For example today is November 7th. The find should delete all files before
If I want to empty a directory, is there any reason I shouldn’t remove it and recreate It?
I’ve looked at these two threads for emptying a directory: Removing a non empty directory programmatically in C or C++ Delete folder and all files/subdirectories However, the functions for emptying a directory given as answers to those threads are very complex, and one answer can encounter a stack overflow. When I think of removing and adding the directory, I’m thinking
Delete all files except a few using bash command
I have a directory containing lot of files in different formats. I would like to know how I can delete all files with specific format (Lets say *.dat) except a few files in a same format (e.g. A.dat and B.dat). Please advise! Answer I’d write a little script (as a command-line one-liner it is slightly too big): As an alternative,
Linux/shell – Remove all (sub)subfolders from a directory except one
I’ve inherited a structure like the below, a result of years of spaghetti code… In reality, this folder is thousands of subfolders large. I only need to keep ./gallery/{number}/full/* (i.e. the full folder and all files within, from each numbered directory within gallery), with everything else no longer required and needs to be deleted. Is it possible to construct a
How to enable confirmation alert when using ‘rm’ command to delete files / folders? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
Command Line to find and delete Similar files in Linux
I want to find and delete all the “similar files as shown below” recursively from the specified directory of my Linux Server by Using COMMAND LINE…. “file.php?p=10&file=load%2Fnew Animations 1%2FAwesome_flowers-(text1).gif&sort=0” “file.php?p=10&file=load%2Fnew Games 1%2FAwesome_flowers_-(text1).gif&sort=1” Note: All these files having different file sizes and The mathed text is in all files is “file.php?p***” Answer This should help you to delete files recursively.. find
Delete files with string found in file – Linux cli
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@example.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@example.com