|
Let's assume that you have a directory "test" containing the following files: [root@blackmod test]# ls -la total 8 drwxr-xr-x. 2 root root 4096 2010-03-10 06:11 . dr-xr-x---. 11 root root 4096 2010-03-10 06:13 .. -rw-r--r--. 1 root root 0 2010-03-10 06:11 file1 -rw-r--r--. 1 root root 0 2010-03-10 06:11 file2 -rw-r--r--. 1 root root 0 2010-03-10 06:11 .hidden If you want to copy all 3 files to /tmp/ you have to use 2 commands: 1 to copy all visible files: [root@blackmod test]# cp -v /root/test/* /tmp/ `/root/test/file1' -> `/tmp/file1' `/root/test/file2' -> `/tmp/file2'
and a second command to copy all hidden files (files which start with a '.'): [root@blackmod test]# cp -v /root/test/.* /tmp/ cp: omitting directory `/root/test/.' cp: omitting directory `/root/test/..' `/root/test/.hidden' -> `/tmp/.hidden' A much easier way to do that is to set the "dotglob" shell option: [root@blackmod test]# shopt -s dotglob {chilicode} --> If set, bash includes filenames beginning with a ‘.’ in the results of pathname expansion. {chilicode} [root@blackmod test]# cp -v /root/test/* /tmp/ `/root/test/file1' -> `/tmp/file1' `/root/test/file2' -> `/tmp/file2' `/root/test/.hidden' -> `/tmp/.hidden'
|