We will enclose the problematic filename or folder name in quotation marks. So, how do we get rid of those directories with unusual names? The solution is straightforward. As an example:Īssume we have a folder called " Our Sales Data" and " baddir#" or " dir2 #" in it. Your folders and files may contain while spaces, semicolons, backslashes, and other characters in Linux. Rm -r -f -v /home/vivek/oldpartpics Delete Folders With Unique Name Characters In other words, the rm command on Linux will explain what happens to our files and folders. To see verbose outputs, we can use the -v option. To remove a folder whose name begins with a “ -,” such as “ -dsaatia,” use one of the following commands: Unless the -f (force) option is specified on the command line, the user is prompted to remove any write-protected files in the directories:Īlternatively, you can use the command that follows: In this example, we will delete the data folder in the current home directory recursively:īefore removing the data directory, the specified /home/vivek/data/ directory will be emptied of all subdirectories, including their subdirectories and files. Examples Of How To Delete A Folder Recursively In other words, "files" include photos, documents, directories/folders, SSD/hard drives, NIC, USB devices, keyboards, printers, and network communications. In Linux and Unix-like systems, everything is considered a file. Put quotes around your problematic filename/folder. Remove a directory or file whose name begins with a '-'. Recursively remove directories and their contents If you use the -type d flag, find will operate in directory mode, and only search for directories, not matching any files. By default, it’s fully recursive, so it will search through all sub-directories to find matches. Never prompt for nonexistent files or arguments. 00:00 01:13 Searching Directories The find command is used to search through directories in Linux.
0 Comments
Leave a Reply. |