Avinash Kumar
Avinash Kumar

Reputation: 787

Linux command to remove multiple files with two dot in the file name

Example file names is

abc.edf.xdc
pqe.ide.xdc

rm -rf "*.\*.xdc" is not working

Upvotes: 0

Views: 2012

Answers (3)

Rahul Patil
Rahul Patil

Reputation: 1034

Source man bash

Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, \, and, when history expansion is enabled, !. The characters $ and ` retain their special meaning within double quotes.

So you don't need to use double quotes, just give rm -vf *.*.xdc

Upvotes: 1

jimm-cl
jimm-cl

Reputation: 5422

rm -rf *.xdc should match all of those files. There's no need to put the extra "*.".

Upvotes: 3

CMoi
CMoi

Reputation: 846

Drop the quotes and it works:

/tmp/a$ touch abc.edf.xdc pqe.ide.xdc
/tmp/a$ ls
abc.edf.xdc  pqe.ide.xdc
/tmp/a$ rm -f *.*.xdc
/tmp/a$ ls
/tmp/a$ 

Upvotes: 5

Related Questions