本帖最後由 s20012797 於 2023-11-24 22:51 編輯
Based on your description, it seems like the issue is related to the size of the files being copied and the number of files being copied. Here are some possible solutions that you can try:
Increase the number of threads: You can try increasing the number of threads used by Robocopy by adding the /MT option followed by the number of threads you want to use. For example, /MT:16 will use 16 threads. This can help speed up the copying process by allowing Robocopy to copy multiple files simultaneously .
Disable logging: Robocopy logs every file that it copies, which can slow down the copying process. You can disable logging by adding the /NFL and /NDL options to your command. For example, /NFL /NDL will disable logging of file and directory names .
Use unbuffered I/O: You can try using unbuffered I/O by adding the /J option to your command. This can help speed up the copying process for large files .
Disable Windows Copy Offload: You can try disabling Windows Copy Offload by adding the /NOOFFLOAD option to your command. This can help speed up the copying process for large files .
it is possible to use Python scripts as an alternative to solve the problem. Python provides various libraries and modules that can help with file operations and copying files.
One option is to use the `shutil` module in Python, which provides a high-level interface for file operations. You can use the `shutil.copytree()` function to recursively copy a directory and its contents to another location. Here's an example:
python:- import shutil
- source_folder = 'path/to/source/folder'
- destination_folder = 'path/to/destination/folder'
- shutil.copytree(source_folder, destination_folder)
複製代碼 This will copy the entire directory tree from the source folder to the destination folder.
You can also use the `os` module in Python to perform file operations. The `os.listdir()` function can be used to get a list of files and directories in a given folder, and then you can use the `shutil.copy()` function to copy individual files. Here's an example:
python:- import os
- import shutil
- source_folder = 'path/to/source/folder'
- destination_folder = 'path/to/destination/folder'
- for file_name in os.listdir(source_folder):
- source_file = os.path.join(source_folder, file_name)
- destination_file = os.path.join(destination_folder, file_name)
- shutil.copy(source_file, destination_file)
複製代碼 This will copy each file from the source folder to the destination folder.
Using Python scripts gives you more flexibility and control over the copying process. You can customize the script according to your specific requirements and handle any additional operations or conditions as needed.
Remember to adjust the file paths (`source_folder` and `destination_folder`) in the examples to match your specific setup. |