1

Linux os

Hello

i have downloaded the file using wget. the file downloaded with some messy name like

index.html?format=csv&timezone=Asia%2FKolkata&use_labels_for_header=true.

now i am trying to remove this file using rm, but its not getting removed.

Linux os

sudo rm -f Unconfirmed\sudo rm -f Unconfirmed\index.html?format=csv&timezone=Asia%2FKolkata&use_labels_for_header=true

how can i removed it from folder.

Rohini Mathur
  • 431
  • 1
  • 5
  • 19
  • 1) Check file permissions. 2) Try enclosing filename in double quotes. Other than that, looks like your file contains special characters that aren't interpreted correctly by rm command. You can provide a cleaner output filename with [wget](https://stackoverflow.com/questions/16678487/wget-command-to-download-a-file-and-save-as-a-different-filename). The rm command is explained here [how to remove all files from a directory on linux](https://www.youtube.com/watch?v=RebdJu5fn0M) and you can also use regex. – InfiniteStack Aug 04 '22 at 15:26

3 Answers3

2

It works as below. Make sure you have permission for that file/folder to edit(delete or update). You have used sudo that is correct.

  • To remove the folder with all its contents(including all interior
    folders):

      rm -rf /path/to/directory 
    
  • To remove all the contents of the folder(including all interior folders) but not the folder itself:

      rm -rf /path/to/directory/* or
    
      rm -rf /path/to/directory/{*,.*} 
    

    if you want to make sure that hidden files/directories are also removed.

  • To remove all the "files" from inside a folder(not removing interior folders):

      rm -f /path/to/directory/{*,.*} 
     Where:
      rm - stands for "remove"   
      -f - stands for "force" which is helpful when you don't want to be asked/prompted 
      if you want to remove an archive, for example.   
      -r - stands for "recursive" which means that you want to go 
      recursively down every folder and remove everything.
    
bangoria anjali
  • 400
  • 1
  • 10
1

rm -rf "yourfilename" put double quotes over your file name. Also check if you have permission to delete this file.

0

make notifies you of the deletion by printing an rm -f command that specifies the file it is deleting.

Eg: enter image description here

Here MergeSort is the file that I need to remove.