Examples of using cp with special characters

To copy files that match on several characters:

   cp *.txt chapt1

This copies all the files in the current working directory with the extension ".txt" to the sub-directory chapt1.


To copy files that match on a single character:

   cp sect?b partA

This copies any file with the name sect[1-9]b to the sub-directory partA.


To copy all the files within a specified range:

   cp sect[1-4]c partB

This copies files sect1c, 2c, 3c and sect4c to the sub-directory partB.


[Home] [Search] [Index]