hrrmsn / ffcleaner

cmd tool to cleanup littered directories (Files&Folders cleaner)
0 stars 0 forks source link

IOError: [Errno 2] No such file or directory #45

Open hrrmsn opened 7 years ago

hrrmsn commented 7 years ago

Full stack trace.

[2017-19-03 13:39:51] Error when copying file: 'i:\ffc_test\all\1\от риты\егоров\!\от старших\Грязнов Н.Д. и др. - Теплообменные устройства газотурбинных и комбинированных установок (1985_abcd_xyz_111222_333_444_Tm'.
[2017-19-03 13:39:51] Traceback (most recent call last):
  File "C:\!Plan9\dev\languages\python\ffcleaner\ffcleaner.py", line 220, in copybytes
    with open(copyto, 'wb') as dst:
IOError: [Errno 2] No such file or directory: 'c:\\dev_test\\ffc_test_cleaned\\unknown\\ - \xd2\xe5\xef\xeb\xee\xee\xe1\xec\xe5\xed\xed\xfb\xe5 \xf3\xf1\xf2\xf0\xee\xe9\xf1\xf2\xe2\xe0 \xe3\xe0\xe7\xee\xf2\xf3\xf0\xe1\xe8\xed\xed\xfb\xf5 \xe8 \xea\xee\xec\xe1\xe8\xed\xe8\xf0\xee\xe2\xe0\xed\xed\xfb\xf5 \xf3\xf1\xf2\xe0\xed\xee\xe2\xee\xea (1985_abcd_xyz_111222_333_444_tm\\\xc3\xf0\xff\xe7\xed\xee\xe2 \xcd.\xc4. \xe8 \xe4\xf0. - \xd2\xe5\xef\xeb\xee\xee\xe1\xec\xe5\xed\xed\xfb\xe5 \xf3\xf1\xf2\xf0\xee\xe9\xf1\xf2\xe2\xe0 \xe3\xe0\xe7\xee\xf2\xf3\xf0\xe1\xe8\xed\xed\xfb\xf5 \xe8 \xea\xee\xec\xe1\xe8\xed\xe8\xf0\xee\xe2\xe0\xed\xed\xfb\xf5 \xf3\xf1\xf2\xe0\xed\xee\xe2\xee\xea (1985_abcd_xyz_111222_333_444_tm'

The problem is that path length more than allowed limit. (260 characters in Windows)

hrrmsn commented 7 years ago

Helpful link.

hrrmsn commented 7 years ago

I decided to do following. I will choosing the kind of OS. If it would be Linux the script will check PATH_MAX constant as described in the previous comment. If it would be Windows the script will check MAX_PATH constant from the ctypes.wintypes module. If it would be Mac OS the script will consider that max path length isn't limited. (See this article.)