New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling errors? #105

Closed
randomgambit opened this Issue May 2, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@randomgambit
Copy link

randomgambit commented May 2, 2018

Hi @jimhester !

Thanks again for this very nice package. I tried to run a little snippet that sorts my folders by size.

dir_info("/hpc/myfolder/", recursive = TRUE) %>%
+   group_by(directory = path_dir(path)) %>%
+   tally(wt = size, sort = TRUE)

but I get an error (after 10min of processing)

Error: [EACCES] Failed to search directory '/hpc/myfolder/blabla': permission denied

Is there a way to avoid these errors with fs so that the tabulation can occur?

Thanks!

@jimhester

This comment has been minimized.

Copy link
Member

jimhester commented May 2, 2018

Not currently, as of now you would need to do the recursion manually and wrap the directory in something like purrr::safely().

@jimhester jimhester added the feature label May 2, 2018

@randomgambit

This comment has been minimized.

Copy link
Author

randomgambit commented May 2, 2018

argh... can you be a bit more specific here? I am afraid I am too noob to do that right now :)

@ThomasThelen

This comment has been minimized.

Copy link

ThomasThelen commented May 3, 2018

Have you tried running the script with elevated privileges? Permission was denied when you attempted to access one of the directories. It would be much better to fix the error than to suppress it.

jimhester added a commit that referenced this issue Jul 23, 2018

@vnijs

This comment has been minimized.

Copy link

vnijs commented Jul 24, 2018

My remaining comments #121 seem directly related to this (open) issue. I installed the warnings branch mentioned in the commit but still get an error and no return value. It would be great to have a worked example on how to most efficiently deal with errors like the below with fs. In my setting it is possible a lot of files in a directory would need to be scanned and using a loop with try and file_info will likely be quite slow

options(fs.should_error = FALSE)
files <- fs::dir_ls("C:/")
fs::file_info(files)
Show Traceback

Rerun with Debug
Error: [EBUSY] Failed to stat 'C:/hiberfil.sys': resource busy or locked

@jimhester jimhester closed this in f03a071 Jul 26, 2018

@jimhester

This comment has been minimized.

Copy link
Member

jimhester commented Jul 26, 2018

This should now be fixed by passing fail = FALSE to dir_info().

@randomgambit

This comment has been minimized.

Copy link
Author

randomgambit commented Jul 26, 2018

well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment