如何避免找不到的文件(WinError 3)? [英] How to avoid files that are not found (WinError 3)?

查看:101
本文介绍了如何避免找不到的文件(WinError 3)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当时试图将我的整个计算机驱动器备份到Google云存储,人们主要告诉我这是荒谬的,在仔细考虑这一切的同时,我决定只做文档和桌面,而我的目标是使用Google云SDK是我的新手,我喜欢挑战.所以我输入:

I was trying to back up my whole computer drive to google cloud storage, people mainly told me that was nonsensical, and while pondering it all, I decided just to do documents and desktop, and my goal was to use the google cloud SDK as I'm new to this and I like a challenge. So I type in:

gsutil -m rsync -n -J -C -e -r -u -U C:\Users\~~~~\Documents gs://~~~~-pc/documents

当我发送邮件时,我收到此消息:

When I send that, I receive this message:

列出文件://C:\ Users ~~~~~ \ Documents时捕获了不可重试的异常:[WinError 3]系统找不到指定的路径:'C:\ Users \ ~~~~~ \文件\ ~~~~~~~~~文件\ 2015 NEGOTIATIONIS \ 2105谈判文件-主要\实施\临时转移和永久非自愿部队重新安置\临时转移与永久非自愿部队重新安排最终于2014年10月3日.docx'CommandException:捕获了不可重试的异常-中止rsync

Caught non-retryable exception while listing file://C:\Users~~~~~\Documents: [WinError 3] The system cannot find the path specified: 'C:\Users\~~~~~\Documents\~~~~~~~~~ Files\2015 NEGOTIATIONIS\2105 NEGOTIATIONS FILE - MAIN\Implementation\Temporary Transfers and Permanet Involuntary Force Rearragement\Temporary Transfers and Permanent Involuntary Force Rearrangement FINAL October 3 2014.docx' CommandException: Caught non-retryable exception - aborting rsync

请帮助!

注意:〜"用于审查

我进行了调试,但我不知道什么意思,这是一个不显示我的个人数据的输出:

I did a debug, and I don't know what anything meant, here's an output that doesn't show my personal data:

Caught non-retryable exception while listing file://C:\Users\~~~~\Documents: [WinError 3] The system cannot find the path specified: 'C:\\Users\\~~~~\\Documents\\~~~~ Files\\2015 NEGOTIATIONIS\\2105 NEGOTIATIONS FILE - MAIN\\Implementation\\Temporary Transfers and Permanet Involuntary Force Rearragement\\Temporary Transfers and Permanent Involuntary Force Rearrangement FINAL October 3 2014.docx'
Traceback (most recent call last):
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\commands\rsync.py", line 653, in _ListUrlRootFunc
    out_file)
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\commands\rsync.py", line 903, in _BatchSort
    current_chunk = sorted(islice(in_iter, buffer_size))
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\commands\rsync.py", line 734, in _FieldedListingIterator
    for blr in iterator:
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\wildcard_iterator.py", line 701, in IterObjects
    bucket_listing_fields=bucket_listing_fields):
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\wildcard_iterator.py", line 721, in IterAll
    bucket_listing_fields=bucket_listing_fields):
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\wildcard_iterator.py", line 611, in __iter__
    blr_object = _GetFileObject(filepath) if include_size else None
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\wildcard_iterator.py", line 531, in _GetFileObject
    return apitools_messages.Object(size=os.path.getsize(filepath))
  File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\~~~~\\Documents\\~~~~ Files\\2015 NEGOTIATIONIS\\2105 NEGOTIATIONS FILE - MAIN\\Implementation\\Temporary Transfers and Permanet Involuntary Force Rearragement\\Temporary Transfers and Permanent Involuntary Force Rearrangement FINAL October 3 2014.docx'

DEBUG: Exception stack trace:
    Traceback (most recent call last):
      File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\__main__.py", line 634, in _RunNamedCommandAndHandleExceptions
        user_project=user_project)
      File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\command_runner.py", line 411, in RunNamedCommand
        return_code = command_inst.RunCommand()
      File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\commands\rsync.py", line 1657, in RunCommand
        diff_iterator = _DiffIterator(self, src_url, dst_url)
      File "C:\Users\~~~~\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\commands\rsync.py", line 999, in __init__
        raise CommandException('Caught non-retryable exception - aborting rsync')
    gslib.exception.CommandException: CommandException: Caught non-retryable exception - aborting rsync

推荐答案

您的问题是由MAX_PATH引起的.默认值为260个字符.

Your problem is caused by MAX_PATH. The default is 260 characters.

方法1-指定UNC路径

使用" \\?\" 前缀路径.这会将最大路径名更改为32,767个字符.

Prefix paths with "\\?\". This changes maximum path names to 32,767 characters.

\\?\C:\Users\~~~~\Documents

方法2-更改Windows注册表

要解决您的问题,需要编辑注册表以支持更长的路径名,最多32,767个字符.

To solve your problem requires editing the registry to support longer path names up to 32,767 characters.

更改此注册表项:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled
Type: REG_DWORD
Value: 1

阅读此文档以获取更多信息:

Read this document for more information:

查看全文

相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆