
我使用的是 Windows 7,我想將資料夾及其所有子資料夾內的所有 PDF 檔案複製到新位置。執行此操作的命令是什麼?
答案1
使用xcopy
命令。您可以轉到命令提示字元並鍵入xcopy /?
以取得使用它的協助。
對於您的特定問題,完整的命令是:
xcopy c:\sourcefolder\*.pdf c:\destinationfolder\ /e
答案2
如果您希望所有 PDF 都放入一個資料夾中:
copy <source path>\*.pdf <destination path> /s
如果你想保留原來的資料夾結構:
xcopy <source path>\*.pdf <destination path> /s
答案3
我強烈建議您使用 RoboCopy,因為它有豐富的選項(遠遠超出了我提供的清單)。但是,由於您只想複製 PDF 文件,請使用此語法
Robocopy C:\Users C:\UserBackup *.pdf
Robocopy Syntax
ROBOCOPY source destination [file [file]…] [options]
where source is Source Directory (drive:\path or \\server\share\path), destination is Destination Directory (drive:\path or \\server\share\path) and file is File(s) to copy where names or wildcards can be specified and default is “*.*” (all files).
Robocopy Options and Switches
Copy options :
/S :: copy Subdirectories, but not empty ones.
/E :: copy subdirectories, including Empty ones.
/LEV:n :: only copy the top n LEVels of the source directory tree.
/Z :: copy files in restartable mode.
/B :: copy files in Backup mode.
/ZB :: use restartable mode; if access denied use Backup mode.
/EFSRAW :: copy all encrypted files in EFS RAW mode.
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:T :: COPY Directory Timestamps.
/SEC :: copy files with SECurity (equivalent to /COPY:DATS).
/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
/NOCOPY :: COPY NO file info (useful with /PURGE).
/SECFIX :: FIX file SECurity on all files, even skipped files.
/TIMFIX :: FIX file TIMes on all files, even skipped files.
/PURGE :: delete dest files/dirs that no longer exist in source.
/MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
/MOV :: MOVe files (delete from source after copying).
/MOVE :: MOVE files AND dirs (delete from source after copying).
Examples:
To use Robocopy is simple, just like how you would use Copy and Xcopy commands. For example, to copy entire folder of C:\Users to C:\UserBackup, simply type:
Robocopy C:\Users C:\UserBackup
答案4
試試這個(在命令列上):
for /r "c:\my\source folder" %i in (*.pdf) do copy "%~fi" "c:\my\destination folder\%~nxi"
在探索者上:
..透過複製貼上,您可以在按住ctrl鍵的同時將來源資料夾拖曳到新的目標位置。