Results 1 to 6 of 6
Hello,
I was hoping that doing
Code:
rm file123\D.txt
would delete all files of the following format: file123.txt, file123a.txt, file123b.txt. But instead it complains that file123D.txt could not be found. ...
- 11-10-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 27
Not a number
Hello,
I was hoping that doingwould delete all files of the following format: file123.txt, file123a.txt, file123b.txt. But instead it complains that file123D.txt could not be found. What am I doing wrong?Code:rm file123\D.txt
Many thanks in advance for you help.
- 11-11-2010 #2
You need
But be careful that will remove all files that start file 123+anything.txt in the current working directory.Code:rm file123*.txt
If you know there's just one character after "123" and before ".txt" you could useCode:rm file123?.txt
Pete
- 11-12-2010 #3Just Joined!
- Join Date
- Aug 2010
- Posts
- 27
Thank you for replying.
I need to delete files that named like : file123.txt, file123A.txt, file123B.txt, file123C.txt, and so on. But I don't want to delete file1234.txt, file1234A.txt, file1234B.txt. Please advice.
- 11-12-2010 #4
I'm not sure if you can do that in one go. You can try this
This would leave "file1234.txt" or "file1235.txt" untouched.Code:rm file123.txt && rm file123[A-Z].txt
If you google "bash scripts" or specifically "bash wildcards", there's plenty of help online.Pete
- 11-13-2010 #5Just Joined!
- Join Date
- Aug 2010
- Posts
- 27
That worked. I did not think of it that way. Thank you again.
- 11-13-2010 #6


Reply With Quote