glob

how to `git ls-files` for just one directory level.

痞子三分冷 提交于 2019-12-04 22:43:50
I'm using msysgit (1.7.9), and I'm looking for the right invocation of the git ls-files command to show just the (tracked) files and directories at the current level, either from the index, or the current working directory if that's easier. Essentially it would give a directory listing similar that that you would see on Github. Coming from Windows, I'm not too familiar with the right way of doing the globbing(?). I think you want git ls-tree HEAD sed'd to taste. The second word of ls-tree's output will be tree for directories, blob for files, commit for submodulesm, the filename is everything

pagination of php glob page

依然范特西╮ 提交于 2019-12-04 18:10:41
i have a page that uses glob to display images that is inside a folder. The thing is, i want to display only 20 pics per page. The tutorials about pagination that i found online is related with database, but i did not use database inside my code. $files = glob("uploaded_files/*.*"); usort($files, function ($a, $b) { return filemtime($b) - filemtime($a); }); foreach ($files as $file) { echo "<img src='$file' style='height:180px;width:180px; border:2px solid black; margin:20px 0px 10px 10px; *margin:10px 0px 10px 20px;'>"; } this is my code. how can i make it so that it displays 20 images per

Why zsh tries to expand * and bash does not?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 17:48:04
问题 I just encountered the following error with zsh when trying to use logcat. Namely, when typing: adb logcat *:D I get the following error in zsh zsh: no matches found: *:D I have to escape the * like : adb logcat \*:D While using bash, I do not get the following error. Why would it be like this? 回答1: zsh warns you by default if you use a glob with no matches. Bash, on the other hand, passes the unexpanded glob to the app, which is a potential problem if you don't know for certain what will

TextIO. Read multiple files from GCS using pattern {}

佐手、 提交于 2019-12-04 16:19:44
I tried using the following TextIO.Read.from("gs://xyz.abc/xxx_{2017-06-06,2017-06-06}.csv") That pattern didn't work, as I get java.lang.IllegalStateException: Unable to find any files matching StaticValueProvider{value=gs://xyz.abc/xxx_{2017-06-06,2017-06-06}.csv} Even though those 2 files do exist. And I tried with a local file using a similar expression TextIO.Read.from("somefolder/xxx_{2017-06-06,2017-06-06}.csv") And that did work just fine. I would've thought there would be support for all kinds of globs for files in GCS, but nope. Why is that? is there away to accomplish what I'm

php “glob” and data-deduplication?

此生再无相见时 提交于 2019-12-04 15:58:02
问题 I have a php-application which is (per request) scanning for the existance of some files. (on a network share) I'm using glob for this, cause usually i just know the beginning of the filename. I noticed, that glob does not return files, that are currently opened by any client, thus my application thinks file_xy is not existing, if somebody has opened it. Is there a way to make glob return opened (:= locked?) files as well? The strange thing is, that this is no where mentioned. However I can

How to use cmake's target_link_libraries to link libraries matching a glob?

荒凉一梦 提交于 2019-12-04 15:17:27
问题 I have prebuilt thirdparty libraries (Boost) which I want to link to my target. All of them is stored under one directory like ${BOOST_PATH}/lib/libboost_thread.a, ${BOOST_PATH}/lib/libboost_log.a, etc. So I would like to do something like this: target_link_libraries(${TARGET} PRIVATE "${BOOST_PATH}/libboost*.a") I've read that FILE(GLOB...) might be used but strongly discouraged. And I am not sure that it would work at all. Why? How would you solve this problem if you cannot change the

Chain Gulp glob to browserify transform

这一生的挚爱 提交于 2019-12-04 09:55:57
I have a project with a few relatively disjoint pages, each including their own entry point script. These scripts require a number of others using commonjs syntax, and need to be transformed by 6to5 and bundled by browserify. I would like to set up a gulp task that captures all the files matching a pattern and passes them on to the bundler, but I'm not sure how to pass files from gulp.src to browserify(filename) . My gulpfile looks like: var gulp = require("gulp"); var browserify = require("browserify"); var to5browserify = require("6to5-browserify"); var source = require("vinyl-source-stream"

Python glob but against a list of strings rather than the filesystem

折月煮酒 提交于 2019-12-04 09:51:04
问题 I want to be able to match a pattern in glob format to a list of strings, rather than to actual files in the filesystem. Is there any way to do this, or convert a glob pattern easily to a regex? 回答1: Good artists copy; great artists steal. I stole ;) fnmatch.translate translates globs ? and * to regex . and .* respectively. I tweaked it not to. import re def glob2re(pat): """Translate a shell PATTERN to a regular expression. There is no way to quote meta-characters. """ i, n = 0, len(pat) res

combining one-column text files into one multi-column file, separated by tabs

人盡茶涼 提交于 2019-12-04 06:13:05
问题 I have several one-column text files that I want to put next to each other (e.g. each file is one column). The only documentation I could find was on appending files to the bottom of other files. That's where I'm stuck. import glob MA_files = glob.glob("MA*continuous*2") with open("MA_continuous_results.csv", "wb") as outfile: for eachFile in MA_files: with open(eachFile, "rb") as infile: eachFile=eachFile.split("maskave_") # eachFile[-1] = 15_2 etc outfile.write('%s\n' % eachFile[-1]) for

Iterate over specific files in a directory

风格不统一 提交于 2019-12-04 05:34:49
问题 I need to get all images that begin with "t_" using glob. What pattern should I use to do this? //get any image files that begin with "t_" -- (t_image.jpg) not (image.jpg) $images = glob("" . $dir . "*.jpg"); foreach($images as $image) { echo $image; } 回答1: foreach (glob("t_*.jpg") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } This implies: foreach (glob("$dir/t_*.jpg") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } See also: http://ca2.php.net