bash wildcard question
bash wildcard question
is there an argument for wildcards, say for example, you want to delete all files that start with "b" OR ends with ".zip"?
i know how to do AND by rm -f b*.zip, but is there a single command for OR, so it would delete .zips and files that start with b? or do i have to do two separate deletes?
thanks. sorry for the n00b question.
Archived topic from Anythingforums, old topic ID:651, old post ID:5648
i know how to do AND by rm -f b*.zip, but is there a single command for OR, so it would delete .zips and files that start with b? or do i have to do two separate deletes?
thanks. sorry for the n00b question.
Archived topic from Anythingforums, old topic ID:651, old post ID:5648
bash wildcard question
seperate the filetypes you want to delete with a space.
rm -f *.txt *.cpp *.html
will delete all .txt text files, all .cpp files, and all .html files.
Archived topic from Anythingforums, old topic ID:651, old post ID:5658
rm -f *.txt *.cpp *.html
will delete all .txt text files, all .cpp files, and all .html files.
Archived topic from Anythingforums, old topic ID:651, old post ID:5658
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
So would the above be rm -f b* *.zip? Just a space and extra star?
Archived topic from Anythingforums, old topic ID:651, old post ID:5661
Archived topic from Anythingforums, old topic ID:651, old post ID:5661
bash wildcard question
the b* would get rid of any file starting with a b, any directory that's empty starting with a b, and the *.zip would get rid of all zip files.Magic wrote: So would the above be rm -f b* *.zip? Just a space and extra star?
Archived topic from Anythingforums, old topic ID:651, old post ID:5702
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
yeah, read my first post.megaspaz wrote:the b* would get rid of any file starting with a b, any directory that's empty starting with a b, and the *.zip would get rid of all zip files.Magic wrote: So would the above be rm -f b* *.zip? Just a space and extra star?
thanks.
Archived topic from Anythingforums, old topic ID:651, old post ID:5703
bash wildcard question
ah... that would get rid of all the zip files starting with b.
Archived topic from Anythingforums, old topic ID:651, old post ID:5706
Archived topic from Anythingforums, old topic ID:651, old post ID:5706
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
let me get this straight...rm -f b*.zip gets rid of .zip files starting with b, andmegaspaz wrote: ah... that would get rid of all the zip files starting with b.
rm -f b* *.zip get's rid of ALL zip files regardless of what letter it starts with and ALL files starting with b regardless of ending, right?
Archived topic from Anythingforums, old topic ID:651, old post ID:5707
bash wildcard question
almost on the last one. the last one will also get rid of any empty directories starting with a b.Magic wrote:let me get this straight...rm -f b*.zip gets rid of .zip files starting with b, andmegaspaz wrote: ah... that would get rid of all the zip files starting with b.
rm -f b* *.zip get's rid of ALL zip files regardless of what letter it starts with and ALL files starting with b regardless of ending, right?
Archived topic from Anythingforums, old topic ID:651, old post ID:5708
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
how do i get rid of directories with files? use recursive argument?megaspaz wrote:almost on the last one. the last one will also get rid of any empty directories starting with a b.Magic wrote:let me get this straight...rm -f b*.zip gets rid of .zip files starting with b, andmegaspaz wrote: ah... that would get rid of all the zip files starting with b.
rm -f b* *.zip get's rid of ALL zip files regardless of what letter it starts with and ALL files starting with b regardless of ending, right?
rm- rf b* *.zip?
Archived topic from Anythingforums, old topic ID:651, old post ID:5709
bash wildcard question
yepMagic wrote:how do i get rid of directories with files? use recursive argument?megaspaz wrote:almost on the last one. the last one will also get rid of any empty directories starting with a b.Magic wrote:
let me get this straight...rm -f b*.zip gets rid of .zip files starting with b, and
rm -f b* *.zip get's rid of ALL zip files regardless of what letter it starts with and ALL files starting with b regardless of ending, right?
rm- rf b* *.zip?
Archived topic from Anythingforums, old topic ID:651, old post ID:5710
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
oh yeah, what if i want to leave the directories alone? even empty ones?
Archived topic from Anythingforums, old topic ID:651, old post ID:5711
bash wildcard question
add in the file extension. if no file extension, you'll need to write a shell script to check if the file is a directory.
Archived topic from Anythingforums, old topic ID:651, old post ID:5712
Archived topic from Anythingforums, old topic ID:651, old post ID:5712
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
hehe, writing scripts is still new to me. is that basically creating your custom code?megaspaz wrote: add in the file extension. if no file extension, you'll need to write a shell script to check if the file is a directory.
Archived topic from Anythingforums, old topic ID:651, old post ID:5713
bash wildcard question
not really as you're only basically going to use the commands and some logical constructs.
Archived topic from Anythingforums, old topic ID:651, old post ID:5714
Archived topic from Anythingforums, old topic ID:651, old post ID:5714
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
i don't understand your jargon, sorry.megaspaz wrote: not really as you're only basically going to use the commands and some logical constructs.
Archived topic from Anythingforums, old topic ID:651, old post ID:5715
bash wildcard question
a shell script is basically a sequence of shell commands you normally use. logical constructs allow for action to be taken if they meet certain requirements.Magic wrote:i don't understand your jargon, sorry.megaspaz wrote: not really as you're only basically going to use the commands and some logical constructs.
Archived topic from Anythingforums, old topic ID:651, old post ID:5716
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
bash wildcard question
ahh, thanks there.megaspaz wrote:a shell script is basically a sequence of shell commands you normally use. logical constructs allow for action to be taken if they meet certain requirements.Magic wrote:i don't understand your jargon, sorry.megaspaz wrote: not really as you're only basically going to use the commands and some logical constructs.
Archived topic from Anythingforums, old topic ID:651, old post ID:5717