About 157,000 results
Open links in new tab
  1. How do I remove a directory and all its contents? - Unix & Linux Stack ...

    In bash all I know is that rmdir directoryname will remove the directory but only if it's empty. Is there a way to force remove subdirectories?

  2. bash - How to delete a directory that contains other subdirectories and ...

    Jul 16, 2023 · 3 I have a directory that contains files and other directories. I need to delete then all in one command, but without asking me for each file if I'm sure that i want to delete i; there is any command …

  3. linux - find and delete file or folder older than x days - Stack Overflow

    It will also delete old files in a directory with newer files. This may result in empty directories staying 8 more days since deletion of a files updates the directory.

  4. Delete files older than X days - Unix & Linux Stack Exchange

    Apr 7, 2015 · I have found the command to delete files older than 5 days in a folder find /path/to/files* -mtime +5 -exec rm {} \\; But how do I also do this for subdirectories in that folder?

  5. How do I remove/delete/replace a folder that is not empty?

    Also note that even if the directory was empty, os.remove would fail again, because the correct function is os.rmdir .

  6. In Unix, how do you remove everything in the current directory and ...

    May 4, 2009 · That command deletes all the files and directories in the current directory and never prompts you to confirm you really want to do that. -f is particularly dangerous if you run the command …

  7. linux - Efficiently delete large directory containing thousands of ...

    You should probably rename the question to something more accurate, like "Efficiently delete large directory containing thousands of files." In order to delete a directory and its contents, recursion is …

  8. How do I remove all sub-directories from within a directory?

    I have a directory that contains a bunch of sub-directories, .zip files, and other random files not contained within a sub-directory. I'd like a command line script to remove all sub-directories from …

  9. What permissions are needed to delete a file in unix?

    Feb 11, 2019 · The minimum number of permissions to delete a file is and . But permission is needed to know the name of the file you want to delete... From the linked doc, it seems that one only needs and …

  10. Check if directory exists and delete in one command

    Jun 3, 2024 · In bash, [ -d something ] checks if there is directory called 'something', returning a success code if it exists and is a directory. Chaining commands with && runs the second command only if the …