The command I used is below.rm -i *.mp3
rm: cannot remove ‘*.mp3’: No such file or directory
Code: Select all
$ ls -l | egrep -Eiv '^d' | egrep -Eio '\..*$' | uniq | sed 's/.*/*&/' | xargs -t rm
And when I run the command separately it works. I can't seem to find out why. I can only assume it is the * causing the issue as hardcoding the filename works, as below:~/test$ ls -l
total 12
-rw-r--r-- 1 luke luke 6 Apr 26 08:34 rmtest
-rw-r--r-- 1 luke luke 30 Apr 25 23:47 testfile
drwxr-xr-x 2 luke luke 4096 Apr 25 13:36 testing
-rw-r--r-- 1 luke luke 0 Apr 26 00:01 text.mp3
Any idea on how I can get the asterisk to work?:~/test$ ls -l | egrep -Eiv '^d' | egrep -Eio '\..*$' | uniq | sed 's/.*/text\.mp3/' | xargs -tp rm -i
rm -i text.mp3 ?...y
rm: remove regular empty file ‘text.mp3’?