glob

pyspark select subset of files using regex/glob from s3

陌路散爱 提交于 2019-12-17 20:55:50
问题 I have a number files each segregated by date (date=yyyymmdd) on amazon s3. The files go back 6 months but I would like to restrict my script to only use the last 3 months of data. I am unsure as to whether I will be able to use regular expressions to do something like sc.textFile("s3://path_to_dir/yyyy[m1,m2,m3]*") where m1,m2,m3 represents the 3 months from the current date that I would like to use. One discussion also suggested using something like sc.textFile("s3://path_to_dir/yyyym1*",

Does glob() have negation?

笑着哭i 提交于 2019-12-17 19:34:16
问题 I know I can do this... glob('/dir/somewhere/*.zip'); ...to get all files ending in .zip , but is there a way to return all files that are not ZIPs? Or should I just iterate through and filter off ones with that extension? 回答1: I don't think glob can do a "not-wildcard"... I see at least two other solutions : use a combinaison of opendir / readdir / closedir Or use some SPL Iterator ; To be more specific, I'm thinking about DirectoryIterator ; and maybe you can combine it with some

How can I make PowerShell handle [ or ] in file name well?

坚强是说给别人听的谎言 提交于 2019-12-17 17:13:57
问题 I modified PowerShell script from PowerShell - Batch change files encoding To UTF-8. # Modified version of https://stackoverflow.com/q/18684793 [Threading.Thread]::CurrentThread.CurrentUICulture = 'en-US' $Encoding = New-Object System.Text.UTF8Encoding($True) # If UTF8Encoding($False), It will be UTF-8 without BOM $source = "C:\Users\AKULA\Desktop\SRC" # source directory $destination = "C:\Users\AKULA\Desktop\DST" # destination directory if (!(Test-Path $destination)) { New-Item -Path

What expands to all files in current directory recursively?

北城以北 提交于 2019-12-17 04:52:12
问题 I know **/*.ext expands to all files in all subdirectories matching *.ext , but what is a similar expansion that includes all such files in the current directory as well? 回答1: This will work in Bash 4: ls -l {,**/}*.ext In order for the double-asterisk glob to work, the globstar option needs to be set (default: on): shopt -s globstar From man bash : globstar If set, the pattern ** used in a filename expansion con‐ text will match a files and zero or more directories and subdirectories. If the

php glob - scan in subfolders for a file

时光总嘲笑我的痴心妄想 提交于 2019-12-17 04:30:47
问题 I have a server with a lot of files inside various folders, sub-folders, and sub-sub-folders. I'm trying to make a search.php page that would be used to search the whole server for a specific file. If the file is found, then return the location path to display a download link. Here's what i have so far: $root = $_SERVER['DOCUMENT_ROOT']; $search = "test.zip"; $found_files = glob("$root/*/test.zip"); $downloadlink = str_replace("$root/", "", $found_files[0]); if (!empty($downloadlink)) { echo

php glob - scan in subfolders for a file

自作多情 提交于 2019-12-17 04:30:13
问题 I have a server with a lot of files inside various folders, sub-folders, and sub-sub-folders. I'm trying to make a search.php page that would be used to search the whole server for a specific file. If the file is found, then return the location path to display a download link. Here's what i have so far: $root = $_SERVER['DOCUMENT_ROOT']; $search = "test.zip"; $found_files = glob("$root/*/test.zip"); $downloadlink = str_replace("$root/", "", $found_files[0]); if (!empty($downloadlink)) { echo

Perl : Get array of all possible cases of a string

大城市里の小女人 提交于 2019-12-13 22:42:06
问题 I need to get an array of all possible cases of a string. Like it's written here: Combination of all possible cases of a string How do I do that in Perl efficiently? I want something like this: print "$_\n" for GetCases('perl'); # Output: perl Perl ... pERl ... PERL Note I tagged glob because it's the function to which I want to feed the result, so people as me will later find the question. However, The question is not only about this particular case of usage. Related question : Should I

gulp.src (glob-stream) positive glob after negative glob kills match

荒凉一梦 提交于 2019-12-13 18:42:19
问题 I was under the impression and also from looking at the code that the a positive glob would only be restricted by negative globs that come AFTER IT. So how comes that gulp.src([ '../WebContent/g/css/ng-client.css' ],{base: '../WebContent'}).pipe(using()) results in ng-client.css being listed. While gulp.src([ '!../WebContent/g/css/*', '../WebContent/g/css/ng-client.css' ],{base: '../WebContent'}).pipe(using()) does not list the same file? I want to figure out what is wrong with the way I am

Unique grunt globbing issue

我只是一个虾纸丫 提交于 2019-12-13 18:32:28
问题 Animate.css is an amazing library that I'm pulling into my project via bower (can't change the folder name). Unfortunately, the folder's name is "animate.css". I want to glob in my whole project (including bower_components) for /**.*.css . Unfortunately, grunt gets angry because animate.css is a folder, not a file. I need a way to ignore the folder, but not the file. Any tips? Here's what my task looks like now: cssmin: { deploy: { files: { '<%= config.prod %>/styles.min.css': ['<%= config

Resolve absolute paths with wildcards in Java 6

时光毁灭记忆、已成空白 提交于 2019-12-13 15:40:09
问题 My problem is that I have a number of directories I have to look into programmatically, in Java. These directories all have the same pattern: d:\a\b\c\??_????\d\ I cannot find a way to do this smartly. Any FileFilter (I use WildcardFileFilter) will need a base directory to look into, as they only works with listFiles(), yet in my case there is not base directory as my paths are absolute. I've unsuccessfully tried a few tricks from the Web and then I'm stuck. Your help will be greatly