for name in `ls` and filenames with spaces
Just don’t use command substitution: use for name in *.
Just don’t use command substitution: use for name in *.
just to add to this… another thing that helped me was listing out all installed modules with npm ls. which will give you a tree of modules and versions… from there it’s pretty easy to identify which ones are duplicates… npm dedupe didn’t do anything for me. I’m not sure if that’s a bug or … Read more
Given the requirements specified in the previously cited MSDN documentation, the following regex should do a pretty good job: public static boolean isValidName(String text) { Pattern pattern = Pattern.compile( “# Match a valid Windows filename (unspecified file system). \n” + “^ # Anchor to start of string. \n” + “(?! # Assert filename is not: … Read more
Good news. Technically, the answer to “how do I clone files with colons in the filename” is to simply use “git clone”. Luckily it is only the checkout that fails on Windows (even under msysgit) and there is a rather clean workaround for this shown below. TL;DR in Git Bash… git clone {repo URL} cd … Read more
I hate having to install libraries (especially those that want me to use installer packages to install them). If you’re looking for a clean solution for a directory listing on an absolute path in Lua, look no further. Building on the answer that sylvanaar provided, I created a function that returns an array of all … Read more
Just for completeness: How could this be achieved without Regular Expressions? var input=”myfile.png”; var output = input.substr(0, input.lastIndexOf(‘.’)) || input; The || input takes care of the case, where lastIndexOf() provides a -1. You see, it’s still a one-liner.
Is this too simple of a solution? #include <iostream> #include <string> int main() { std::string fn = “filename.conf”; if(fn.substr(fn.find_last_of(“.”) + 1) == “conf”) { std::cout << “Yes…” << std::endl; } else { std::cout << “No…” << std::endl; } }
I would recommend using File.renameTo() rather than running the mv command, since I’m fairly sure the latter isn’t supported.. Have you given your application permission to write to the SD Card? You do this by adding the following to your AndroidManifest.xml: <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” /> If it doesn’t work once the permission is added check the … Read more
Historically, the first extensions used for C++ were .c and .h, exactly like for C. This caused practical problems, especially the .c which didn’t allow build systems to easily differentiate C++ and C files. Unix, on which C++ has been developed, has case sensitive file systems. So some used .C for C++ files. Other used … Read more