Copying files excluding some files

Hi,

I have a folder which contains files in this format.

abc-bin.000001
abc-bin.000002
abc-bin.000003
abc-bin.000004
abc-bin.000005
abc-bin.000006
abc-bin.000007
abc-bin.000008
abc-bin.000009
abc-bin.000010
abc-bin.index

I want to copy all the files between
abc-bin.000004 and abc-bin.000010 excluding the files abc-bin.000004 and abc-bin.000010.

Any idea how to do it.

for x in {5..9}; do cp abc-bin.00000$x /target/dir/; done

hi,

The number of those files are getting generated randomly.

for x in abc-bin.00000[5-9]; do cp $x /target/dir/; done

Your requirements are contradictory. Is it random or is it in a sequence as described in post #1?

The files will be generated randomly with those numbers.
What i want to do is the user will pass two file names like abc-bin.00004 and abc-bin.000010 and the script will copy all the files in between those passed filenames exclding the two filenames passed.

The user can pass any two file names.Need to keep them dynamic.

Not sure if this can be done with a smart usage of shell's pathname expansion/globbing (btw, what shell?); put this into a script:

for (( i=1+10#${1#*\.}; i<10#${2#*\.}; i++)) ; do cp -f $(printf "%s.%06d" ${1%\.*} $i) targetdir; done

and execute with bash.