From 6b29931e92a985140fd6ea8d6a949ef16c4d2265 Mon Sep 17 00:00:00 2001 From: hong-revo Date: Sun, 22 Apr 2018 22:50:04 +1000 Subject: [PATCH] handle #81 in hdfs_dir --- R/hdfs_utils.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/hdfs_utils.R b/R/hdfs_utils.R index 33c22bb..211facf 100644 --- a/R/hdfs_utils.R +++ b/R/hdfs_utils.R @@ -86,9 +86,9 @@ hdfs_dir <- function(path=".", ..., full_path=FALSE, include_dirs=FALSE, recursi else if(dirs_only) output <- output[substr(output, 1, 1) == "d"] - #output <- gsub("^[^/]*(/.*)$", "\\1", output) ## NOTE: regex below will break on filenames with a space - output <- substr(output, regexpr("[^ ]+$", output), nchar(output)) + #output <- substr(output, regexpr("[^ ]+$", output), nchar(output)) + output <- sub("^[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+", "", output) if(!full_path && !recursive) output <- basename(output)