1

Already saw some negative lookback answers here, for some reason i was not able to use ls -l with these.

Let's assume i have three files:

sample_one.zip
sample_two.zip
sample_three.zip

What i want is to simply ls -l (regex).zip and exclude filenames containing one and two. tried

   ls -l '*(?!one|two).zip' 

but no luck!

aprin
  • 123
  • 1
  • 9

2 Answers2

1

If you can utilize the find command, you could:

find -name "*.zip" . ! -regex ".*\(\one\|\two\).zip"

You could then use -exec to action the copy.

Raman Sailopal
  • 12,320
  • 2
  • 11
  • 18
0

Try rsync if that's a option

rsync -av --exclude '*one.zip' --exclude '*two.zip' /from /to
papkass
  • 1,261
  • 2
  • 14
  • 20