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

    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 …

    Aug 31, 2014 · 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 …

  3. linux - Remove a symlink to a directory - Stack Overflow

    8 If rm cannot remove a symlink, perhaps you need to look at the permissions on the directory that contains the symlink. To remove directory entries, you need write permission on the …

  4. Check if directory exists and delete in one command

    Jan 30, 2011 · 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 …

  5. 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?

  6. How to get over "device or resource busy"? - Unix & Linux Stack …

    The tool you want is lsof, which stands for list open files. It has a lot of options, so check the man page, but if you want to see all open files under a directory: lsof +D /path That will recurse …

  7. Ansible: How to delete files and folders inside a directory?

    Jul 5, 2016 · The below code only deletes the first file it gets inside the web dir. I want to remove all the files and folders inside the web directory and retain the web directory. How can I do …

  8. How to remove files and directories quickly via terminal (bash shell ...

    Apr 15, 2017 · When I use the rmdir command it only removes empty folders. If I have a directory nested with files and folders within folders with files and so on, is there a way to delete all the …

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

    Feb 11, 2019 · This directory contains two files (file1 & file2) I initially though that only write access was needed (on the directory) for me to be able to delete/remove a file via (rm …

  10. How can I delete a file or folder in Python? - Stack Overflow

    Deleting a file or folder in Python There are multiple ways to delete a file in Python but the best ways are the following: os.remove() removes a file. os.unlink() removes a file. It is a Unix alias …