PythonistaScripts icon indicating copy to clipboard operation
PythonistaScripts copied to clipboard

Hidden file or directory starting with "."

Open alanzchen opened this issue 9 years ago • 6 comments

DropboxSync.py cannot handle these cases correctly. When encounter a hidden file or directory, it will raise OSError: no such file or directory.

if not os.path.exists(local_folder):
        os.mkdir(local_folder)

Maybe iOS does not allow app to create a hidden file or directory inside the container? Can we simply skip these files and directories?

alanzchen avatar Sep 01 '16 16:09 alanzchen

I ran into this in a traceback in a code repo. AFAICT, this happens when paths go too deep, e.g. {pythonista root}/Code/foo1/foo2/foo3/ERROR ERROR doesn't get synced and throws the traceback.

--EDIT-- Even worse, the files in foo3 don't sync, but there's no error.

tildebyte avatar Sep 08 '16 16:09 tildebyte

Is it simply a matter of depth?

alanzchen avatar Sep 13 '16 08:09 alanzchen

Can you post a full directory listing?

I've done some pretty deep folder layouts in testing and I'd be surprised if it was that.

dhutchison avatar Sep 13 '16 09:09 dhutchison

Sanitizing the directory names would be a lot of work, but suffice to say that all of the file/folder names for this particular tree are plain ASCII and well within 32 characters (probably less than 15). The only dot files which I know of would be the .git dirs, and I've not seen any errors relating to them, although it's also the case that they're not syncing.

tildebyte avatar Sep 13 '16 12:09 tildebyte

os.mkdir() isn't recursive, so if it tries to create a folder inside a folder which doesn't yet exist, it'll throw that error.

Try using os.makedirs() instead to create all directories in the specified path as needed.

glitchassassin avatar Sep 19 '16 11:09 glitchassassin

@cdiscrete since you are (presumably) able to reproduce the issue, can you try the suggestion by @glitchassassin to see if that works?

dhutchison avatar Oct 06 '16 20:10 dhutchison