Bash to delete file in directory

Will the below bash delete all the "snps.ivg" in the given directory? Thank you :slight_smile:

 find N:\all_array\Samples -maxdepth 1 -type f -name "snps.ivg" -delete 

I'd start here

1 Like

Any reason why you don't want to use rm snps.ivg ?

1 Like

Try it without the -delete and see if it prints the names. If it prints the right names, you're on the right track.

1 Like

So to use rm snps.ivg to delete all 1000 entries would I use

cd "directory"

while true
do rm snps.ivg
done

I am cautious before using rm . Thank you :).

find will not delete files if you don't put -delete into it. If you run it without the -delete it will only print names.

How is it possible to have plenty of files with the same name in one directory?
Do you mean instead �All files ending with "snps.ivg"� or �All "snps.ivg" in all sub-directories�?
Thanks for clarifying, or sorry if I missed something :p.