How do I move a file with Ruby?

You can use FileUtils to do this. #!/usr/bin/env ruby require ‘fileutils’ FileUtils.mv(‘/tmp/your_file’, ‘/opt/new/location/your_file’) Remember; if you are moving across partitions, “mv” will copy the file to new destination and unlink the source path.

How to find files that match a wildcard string in Java?

Try FileUtils from Apache commons-io (listFiles and iterateFiles methods): File dir = new File(“.”); FileFilter fileFilter = new WildcardFileFilter(“sample*.java”); File[] files = dir.listFiles(fileFilter); for (int i = 0; i < files.length; i++) { System.out.println(files[i]); } To solve your issue with the TestX folders, I would first iterate through the list of folders: File[] dirs = … Read more

Batch: Remove file extension

You can use %%~nf to get the filename only as described in the reference for for: @echo off for /R “C:\Users\Admin\Ordner” %%f in (*.flv) do ( echo %%~nf ) pause The following options are available: Variable with modifier Description %~I Expands %I which removes any surrounding quotation marks (“”). %~fI Expands %I to a fully … Read more

What are the pros and cons of parquet format compared to other formats?

I think the main difference I can describe relates to record oriented vs. column oriented formats. Record oriented formats are what we’re all used to — text files, delimited formats like CSV, TSV. AVRO is slightly cooler than those because it can change schema over time, e.g. adding or removing columns from a record. Other … Read more

Dynamically load a JavaScript file

You may create a script element dynamically, using Prototypes: new Element(“script”, {src: “myBigCodeLibrary.js”, type: “text/javascript”}); The problem here is that we do not know when the external script file is fully loaded. We often want our dependant code on the very next line and like to write something like: if (iNeedSomeMore) { Script.load(“myBigCodeLibrary.js”); // includes … Read more

How to open every file in a folder

Os You can list all files in the current directory using os.listdir: import os for filename in os.listdir(os.getcwd()): with open(os.path.join(os.getcwd(), filename), ‘r’) as f: # open in readonly mode # do your stuff Glob Or you can list only some files, depending on the file pattern using the glob module: import os, glob for filename … Read more