搜尋此網誌

2011年10月22日 星期六

EFI Shell commands -- CP(複製一個或多個檔案或目錄到另一個位置)

Copies one or more files or directories to another location.

CP [-r] [-q] src [src...] [dst]
-r      - Recursive copy
-q      - Quiet copying (replace existing files without prompt)
src     - Source file/directory name (wildcards are permitted)
dst     - Destination file/directory name (wildcards are not permitted)
Note:
  1. The '-r' option must be specified if src is a directory. If '-r' is specified, then the source directory will be recursively copied to the destination. 'src' itself will be copied.
  2. If the 'dst' parameter is not specified, then the current directory is assumed to be the destination.
  3. 'CP -r src1 src2 dst' copies all files and subdirectories in 'src1' and 'src2' to the destination 'dst'. 'src1' and 'src2' themselves are also copied. The 'dst' parameter will be interpreted as a directory.
  4. Copying a directory or file to itself is not allowed.
  5. If an error occurs, CP will exit immediately and the remaining files or directories will not be copied.
  6. When 'cp' is executed with a script file, it always performs quiet copying regardless of whether the '-q' option is specified.
  7. If you are copying multiple files, the destination must be an existing directory.
Examples:


* To display the contents of the current directory:    
* To display the contents of the current directory:    
    fs0:\〉 ls    
    Directory of: fs0:\〉    
      06/18/01  01:02p  〈DIR〉         512  efi
      06/18/01  01:02p  〈DIR〉         512  test1
      06/18/01  01:02p  〈DIR〉         512  test2
      06/13/01  10:00a             28,739  IsaBus.efi    
      06/13/01  10:00a             32,838  IsaSerial.efi    
      06/18/01  08:04p                 29  temp.txt    
      06/18/01  08:05p  〈DIR〉         512  test
              3 File(s)      61,606 bytes
              4 Dir(s)

  * To copy a file in the same directory but change the file name:    
  fs0:\〉 cp temp.txt readme.txt    
  copying fs0:\temp.txt -〉 fs0:\readme.txt
     - [ok]

  * To copy multiple files to another directory:    
  fs0:\〉 cp temp.txt isaBus.efi \test    
  copying fs0:\temp.txt -〉 fs0:\test\temp.txt   
     - [ok]    
  copying fs0:\isaBus.efi -〉 fs0:\test\IsaBus.efi
     - [ok]

  * To copy multiple directories recursively to another directory:
    fs0:\〉 cp -r test1 test2 boot \test
    copying fs0:\test1 -〉 fs0:\test\test1
    copying fs0:\test1\test1.txt -〉 fs0:\test\test1\test1.txt
     - [ok]
    copying fs0:\test2 -〉 fs0:\test\test2
    copying fs0:\test2\test2.txt -〉 fs0:\test\test2\test2.txt
     - [ok]
    copying fs0:\boot -〉 fs0:\test\boot
    copying fs0:\boot\shell.efi -〉 fs0:\test\boot\shell.efi
     - [ok]

  * To verify the results of the cp commands above:
    fs0:\〉 ls \test
    Directory of: fs0:\test
      06/18/01  01:01p  〈DIR〉     512  .
      06/18/01  01:01p  〈DIR〉       0  ..
      01/28/01  08:21p  〈DIR〉     512  test1
      01/28/01  08:21p  〈DIR〉     512  test2
      01/28/01  08:21p  〈DIR〉     512  boot
      01/28/01  08:23p             29  temp.txt      
      01/28/01  08:23p         28,739  IsaBus.efi              
              2 File(s)      28,828 bytes              
              5 Dir(s)


沒有留言:

張貼留言