This image contains a java class that copies random files.
367
A java class that copies random files that are located in a folder and it subsequent folders to a destination, supplying options such as limiting the number of files, the total space in bytes to copy, or filtering the files by its extension; ensuring that the files with the same name are not overwritten by renaming them.
You can use the RandomFileCopier by two ways:
RandomFileCopier class in your java projectint maxFilesToCopy = 25;
int maxBytes = 50000;
String[] extensions = new String[]{"mp3", "txt", "xml", "pdf"};
RandomFileCopier copier = new RandomFileCopier("/source_folder/", "/target_folder/", maxFilesToCopy);
copier.setFilterExtensions(extensions);
copier.setVerbose(true);
copier.setMaxBytesToCopy(maxBytes);
copier.randomCopy();
// copier.abort()
.jar (available in
releases) passing arguments to it
(thanks to docopt) with the following usage:Usage:
java -jar RandomFileCopier.jar <source_directory> <target_directory> <max_files> [-v] [-s=<maxbytes>] [-e=<extension>]...
Options:
-h, --help Show this help text.
<max_files> The maximum number of files.
-v, --verbose Show some extra information of the process.
-e, --extension=<extension> A required extension of a file to be copied.
-s, --space=<maxbytes> The maximum bytes to copy in the destination.
Example:
java -jar RandomFileCopier-0.2.3.jar /source /target 10 -v -s=5000 -e=pdf -e=txt
Would print:
Scanning source directory...
XY files found
Copying files to the destination directory...
Copied .../folder/under/source/file0.txt [31415 B]
Copied .../folder/under/source/file1.txt [31415 B]
Copied .../folder/under/source/file2.txt [31415 B]
Copied .../folder/under/source/file3.pdf [31415 B]
Copied .../folder/under/source/file4.pdf [31416 B]
Done. 5 files, xyz B copied
Content type
Image
Digest
Size
412.6 MB
Last updated
over 8 years ago
docker pull transgressoft/randomfilecopier