Need a good files creation tool - file

I want to create a test setup which should have a 4tb of High density filesystem.
I've tried some tools(wst) but they are crashing after sometime. After struggling for two days im able to fill not even 20% of disk space. I need this tool on windows. Any suggestions?

You can use Disk Tools. I used it once for stress testing a hard disk which presumably had bad sectors.

You can:
create a small file in a directory,
copy-paste the directory itself,
put the duplicate directory into the original one,
and repeat steps 2 and 3 until you reach your need (about thirty times, depending on the size of the initial file).

If all you want is simply to create many many files, you can use this batch script that copies a given file for as many times as possible. There is no stop condition, but I suppose the counter variable will overflow after about 2^31.
Use the script like extreme_copy my_test_file.txt where the test file can have any size you want.
This is the script:
#ECHO OFF
IF "%1"=="" GOTO END
IF NOT EXIST "%1" GOTO END
REM copy loop
SET FILE_NUMBER=1
:COPY
copy "%1" "%~dpn1_%FILE_NUMBER%%~x1" > nul
REM show some progress
SET /A SHOW_ITERATIONS="%FILE_NUMBER% %% 1000"
IF /I %SHOW_ITERATIONS%==0 ECHO %FILE_NUMBER% files created...
SET /A FILE_NUMBER=%FILE_NUMBER% + 1
GOTO COPY
:END

I made a C# console app do create random files, with random content from 2kb to 10kb.
Compile it ( this is .net 2, but im sure it will compile with any .NET version )
Run like this:
YourExe d:
YourExe d:\temp2
Semi disclaimer, if you run the app long enough it might get a stackoverflow, just start it again if that happens. File names are random, so it will not create any issues
class Program
{
static void Main(string[] args)
{
if (args.Length != 1 || !Directory.Exists(args[0]))
{
Console.WriteLine("Arg should be: C:\\ (or your drive letter)");
return;
}
const int RandomFilesToCreate = int.MaxValue;
for (int i = 0; i < RandomFilesToCreate; i++)
{
string FileName = CreateRandomFile(args[0]);
Console.WriteLine(i + ") Wrote file " + FileName);
}
}
static Random gRan = new Random();
static string CreateRandomFile(string Path)
{
byte[] FileContent = new byte[gRan.Next(2,10) * 1024] ;
// generate a random filename
string FileName = Path + "\\TempF_" + gRan.Next(0, int.MaxValue) + "_" + gRan.Next(0, int.MaxValue) + "_" + gRan.Next(0, int.MaxValue) + ".tmp";
while(File.Exists(FileName))
FileName = Path + "\\TempF_" + gRan.Next(0, int.MaxValue) + "_" + gRan.Next(0, int.MaxValue) + "_" + gRan.Next(0, int.MaxValue) + ".tmp";
// fill with random bytes.
gRan.NextBytes(FileContent);
// Write to disk
File.WriteAllBytes(FileName, FileContent);
return FileName;
}
}

I can't really make the two terms "Windows" and "4TB of data" match in my head. Windows is a desktop OS written for the average user who does a bit of Word and browsing with IE. If you have special needs, use a server OS like Linux. It comes with all the tools you need to handle large amounts of data. You also get FS benchmark tools like bonnie.
You can also choose from a large set of filesystems where some (like ZFS) are designed for huge sizes (Exabytes). NTFS can theoretically handle this amount of data but I'm not aware that anyone has actually tried this. See this Wikipedia article for some pointers.
[EDIT] Since you use a "server" edition of Windows (which translates to "Desktop OS with a couple of nice wizards to set up the network"), you must have a professional support contract with Microsoft. This means you can just call them, explain your problem and let them tell you how to solve it.
Sorry, I'm being unnecessarily sarcastic here but I find all this really amusing ;) Just because the marketing department slaps a "Server" label on something doesn't mean that a professional administrator would buy it. I'd be surprised if someone would post an answer to the effect "we did the same thing and we could get it working reliably and to our satisfaction".

Related

Run an LibreOffice Command-Line Script through a loop

I have been able to successfully run the below code on an individual file, but I would like to find a way to have it run so that it loops through all the files shown in a directory. I believe that loops are possible within CMD.exe, but I am not having any success. Any help would be greatly appreciated.
"C:\Program Files (x86)\LibreOffice 5\program\scalc.exe" --convert-to DBF --infilter="csv:44,34,76,1,1/2/2/2/3/2/4/2/5/2/6/2/7/2/8/2/9/2/10/2/11/2/12/2/13/2/14/2/15/2/16/2/17/2/18/2/19/2/20/2/21/2/22/2/23/2/24/2/25/2/26/2/27/2/28/2/29/2/30/2/31/2/32/2/33/2/34/2/35/2/36/2/37/2/38/2/39/2/40/2/41/2/42/2/43/2/44/2/45/2/46/2/47/2/48/2/49/2/50/2/51/2/52/2/53/2/54/2/55/2/56/2/57/2/58/2/59/2/60/2/61/2/62/2/63/2/64/2/65/2/66/2/67/2/68/2/69/2/70/2/71/2/72/2/73/2/74/2/75/2/76/2/77/2/78/2/79/2/80/2/81/2/82/2/83/2/84/2/85/2/86/2/87/2/88/2/89/2/90/2/91/2/92/2/93/2/94/2/95/2/96/2/97/2/98/2/99/2/100/2/101/2/102/2/103/2/104/2/105/2/106/2/107/2/108/2/109/2/110/2/111/2/112/2/113/2/114/2/115/2/116/2/117/2/118/2/119/2/120/2/121/2/122/2/123/2/124/2/125/2/126/2/127/2/128/2/129/2/130/2/131/2/132/2/133/2/134/2/135/2/136/2,0,false,false" C:\Users\jdavidson\Desktop\DBFCONVERT\57826001_JQSAMPLE.csv --outdir C:\Users\jdavidson\desktop\complete
If you have any ideas for how I might be able to achieve this it be a huge help. I am working to build this as part of a larger workflow and make it repeatable.
UPDATE
I was able to iterate(Loop) through all of the files in my directory by creating a batch file and placing it within the directory that I am going to be using for converting moving forward
for /r %%i in (*.csv) do "C:\Program Files (x86)\LibreOffice 5\program\scalc.exe" --convert-to DBF --infilter="csv:44,34,76,1,1/2/2/2/3/2/4/2/5/2/6/2/7/2/8/2/9/2/10/2/11/2/12/2/13/2/14/2/15/2/16/2/17/2/18/2/19/2/20/2/21/2/22/2/23/2/24/2/25/2/26/2/27/2/28/2/29/2/30/2/31/2/32/2/33/2/34/2/35/2/36/2/37/2/38/2/39/2/40/2/41/2/42/2/43/2/44/2/45/2/46/2/47/2/48/2/49/2/50/2/51/2/52/2/53/2/54/2/55/2/56/2/57/2/58/2/59/2/60/2/61/2/62/2/63/2/64/2/65/2/66/2/67/2/68/2/69/2/70/2/71/2/72/2/73/2/74/2/75/2/76/2/77/2/78/2/79/2/80/2/81/2/82/2/83/2/84/2/85/2/86/2/87/2/88/2/89/2/90/2/91/2/92/2/93/2/94/2/95/2/96/2/97/2/98/2/99/2/100/2/101/2/102/2/103/2/104/2/105/2/106/2/107/2/108/2/109/2/110/2/111/2/112/2/113/2/114/2/115/2/116/2/117/2/118/2/119/2/120/2/121/2/122/2/123/2/124/2/125/2/126/2/127/2/128/2/129/2/130/2/131/2/132/2/133/2/134/2/135/2/136/2,0,false,false" C:\Users\jdavidson\Desktop\DBFCONVERT\57826001_JQSAMPLE.csv --outdir C:\Users\jdavidson\desktop\complete %%i
Note that I used a for Loop to achieve what I wanted.
for /r %%i in ('list directory if command not being run in specific directory already; you can also but * for all files in directory or *.ext for the extension of only certain files) do 'add in command %%i
Option 1: You can actually convert multiple documents with just one execution of Open/Libre Office.. without a loop. Just use a wildcard, eg:
"C:\Program Files (x86)\LibreOffice 5\program\scalc.exe" --convert-to DBF mydir\*.csv
Option 2: I assume that Windows has a limit on the number of files you can pass in that way.. not sure what that limit is.. but if you exceed that limit, you can use this python program I wrote to do this just a few days ago.. as part of a project I am still working on. In my case I am converting .doc to .odt, and obviously my directories aren't the same as yours. But it would be quite easy for you to adjust this to your needs... One thing I wanted to do with mine is to check for the existence of the converted file and skip it if it exists.. so that if a few new files are added it can be run again to convert them without redoing them all...
The docpath should be set to the location of your files, and soffice to the pathname of your Calc exe.. and if you leave things the way I have them, that's where the program puts the converted files too.. and checks for their existence. Also, I walk the path looking for input files.. so if for whatever reason you have your files in different subdirectories, it will find them and put the conversion in the same directory.
import os, sys, re, subprocess
docpath = 'doc'
soffice = 'C:\Program Files\LibreOffice 5\program\soffice.exe'
convert = '"%s" --headless --convert-to odt --outdir "%s" "%s"'
def plog(fmt = '', *args):
sys.stdout.write(fmt % args)
sys.stdout.flush()
def log(fmt = '', *args):
plog((fmt + '\n'), *args)
def convert():
odtfiles = []
for subdir, dirs, files in os.walk(docpath):
for file in files:
if not file.endswith('.doc'):
continue
docfile = os.path.join(subdir, file)
odtfile = re.sub(r"\.doc$", ".odt", docfile)
plog("%s -> %s: " % (docfile, odtfile))
if not os.path.isfile(odtfile):
plog('Converting.. ')
subprocess.check_output(convert % (soffice, docpath, docfile), shell=True)
log('OK.')
odtfiles.append(odtfile)
return odtfiles
odtfiles = convert()
Just install Python27.. and set the convert string to have the correct settings for your conversion. Along with a few other changes that should be pretty easy.. but if you need help, ask in comments.

.PIF With ? Allowed for a Variable Request

Up until now I have been using the .PIF shortcut with "?" to call for a variable that is then used in a batch file to produce specific results. We have over project 10,000 folders, and the JobFind.PIF tool really satisfied a quick search. It is like a moving or floating Shortcut.LNK to any one folder in the larger directory.
Program Line Call Inside JobFind.PIF
S:\YoursTruly\JobFind\JobFind.bat ?
JobFind.bat Contents Where %1 = ?
explorer "P:\SDIT_L~1\Projects\000030%1"
Is there a simple replacement for my olde fashion JobFind.pif tool?
Thank you,
GPB
You could replace it with either a command-line or GUI VBScript. Here's an example:
strJob = InputBox("Enter the job number:")
With CreateObject("WScript.Shell")
.Run "explorer.exe P:\SDIT_L~1\Projects\000030" & strJob
End With

Batch or VBS | How to check the bitrate of a music file?

I need to check the bitrate of a music file, I need to receive the number in digits like: 192000 (for 192 kbps), 320000 (for 32kbps) or (+)3000000 for wavs and uncompressed music. I mean I need exactly the number, If an MP3 is VBR and is compressed at 194 kbps, I need the 194000 number, not the current CBR 192000.
I was do this job with MEDIAINFO (x64) CLI Program, In Batch:
for /f "tokens=*" %%%% in ('mediainfo "%%a" "--Inform=General;%%BitRate/String%%"') do set "BitRate=%%~%%"
But I have 35.000+ files to check and then the comprobation of all files is more than 2 hours of time.
I need a simple code to check it, Not a program which need to execute it and to waste that lot of time...
Is very important that the code needs to recognize at least this filetypes (I mean the internal bitrate):
AIFF, FLAC, M4A, MP3, OGG, WAV, WMA.
And can't be a code for Ruby or Python, because I'll need to "compile" it and sure when is "compiled" waste a lot of time to check much files (Cause the uncompression of the .exe compiled).
More info: I thinked about store the results in a file and then do a comparision to chek only new added files, But I can't store the result to do a comparision at the next run cause sometimes I'll need to replace checked files (old files). By the way neither I can't handle this by file datestamps. Need to be one unique procediment to check ALL the files, Ever (Or this is what I think...).
I tried another method to check the bitrates, I'm really sure this is what I need but I can't get it run like I want...
This VBS uses the DBPowerAmp program API, And shows a window with info (included the bitrate), But with a window I can't do nothing... Maybe if I can redirect the windows info to a text file... And then set the variable "Bitrate" by reading the bitrate info in the text file... But I don't know how to do that:
' create shell object
Set WshShell = CreateObject("WScript.Shell")
' Create dMC Object
Set dMC = CreateObject("dMCScripting.Converter")
'Read audio properties of a file
Dim AudioProps
AudioProps = dMC.AudioProperties("C:\test.aac")
Call WshShell.Popup(AudioProps, , "Returned Audio Properties", 0)
I've tried to "convert" that code into Batch, like this, But don't run, I get nothing:
#echo off
rundll32.exe dMCScripting.Converter.AudioProperties("C:\Test.aac") > test.txt
exit
Oh and I've tried this too, but waste more time than mediainfo:
mplayer "test.aac" -frames 0 | findstr "kbit"
To give you an idea of what it is like in Ruby, audioinfo is just one of the many libraries doing such things.
require "audioinfo"
AudioInfo.open("R:/mp3/j/John Coltrane - I Think.mp3") do |info|
puts info.to_h
end
=>{"artist"=>"John Coltrane", "album"=>"John Coltrane", "title"=>"I Think", "tracknum"=>nil, "date"=>nil, "length"=>272, "bitrate"=>128}
Here a vbs script, works with mp3, the rest i didn't try
Set objPlayer = CreateObject("WMPlayer.OCX" )
Set colMediaCollection = objPlayer.mediaCollection
Set colMedia = colMediaCollection.getAll()
For i = 0 to colMedia.Count - 1
Set objItem = colMedia.Item(i)
Wscript.Echo objItem.Name & " : " & objItem.GetItemInfo("bitrate")
Next
See http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP+Get~Audio~File~Information.txt for a list of attributes you can use.

Applescript or Automator to save Mandelbrot image from website progressivly

Hello I have recently created a C program for my UNI Computing course that generates a web server at localhost:2020 and sends a bmp file of the Mandelbrot set. If you dont know what that is dont worry, its the url part thats important.
The URL is formatted as follows
http://X_(x coordinate)_(y coordinate)_(Zoom Level).bmp
so
http://localhost:2020/X_-0.15_1.03_56.bmp
returns
x: -0.15
y: 1.03
zoom: 56
My goal here is to have an automated process that can take in an x,y position (in the code is fine) and repetitively load the image from the server, each time with a zoom level increased by .01 and save it to either a folder or preferably load them all into a file to be presented as a video.
Im well aware that this would be easier to do in C and just have it save to the file but my goal is to familiarise myself with applescript/automator or a similar program with tasks like this.
Its designed to be a fun learning experience for myself and I will really appreciate any help I can get thank you.
Something like this may work for part of your task. We are downloading all of the images (at each zoom level) using the unix command line utility "curl". Each image is saved with the name from the url to a folder that you choose. We put this code inside a repeat loop so we can increment the zoom level.
The script shows lots of stuff, particularly how to insert variables directly into an applescript (e.g. hard-coded) and how to get input from the user. It also shows how to run command line utilities from within an applescript (e.g. curl).
So this script should get you started. See if it helps.
-- hard-coded variables
set minZoomLevel to 0
set maxZoomLevel to 10
set zoomIncrement to 0.1
-- get user input variables
set outputFolder to choose folder with prompt "Pick the output folder for the images"
set xDialog to display dialog "Enter the X coordinate" default answer ""
set yDialog to display dialog "Enter the Y coordinate" default answer ""
set posixStyleOutputFolder to POSIX path of outputFolder
set x to text returned of xDialog
set y to text returned of yDialog
set i to minZoomLevel
repeat while i is less than or equal to maxZoomLevel
set fileName to "X_" & x & "_" & y & "_" & (i as text) & ".bmp"
set theURL to "http://localhost:2020/" & fileName
do shell script "curl " & theURL & " -o " & quoted form of (posixStyleOutputFolder & fileName)
set i to i + zoomIncrement
end repeat

Need a hand in Windows batch processing syntax

I have compiled a C++ program on Windows, and I need it to process a huge number of my data files. The files are named, for instance, "x0000y" to "x9999y".
The C++ program only takes one file at a time, create the output of each respective file, save somewhere, and terminate. I do not want to hard code the program, as my data set does not always have the same number of files - and keep recompiling the program just for this is not cool. So I am looking for a quick way of doing this: batch processing.
Here comes the trouble: I am having trouble trying to get the batch syntax correct and valid. So could somebody show me the following pseudocode in batch processing version?:
for (int i = 0; i < lastFile; i++){
String filename;
/*
Because the files are named "x0000y", "x0034y", etc.
We need to put in all the extra 0s in the string if i is less than 1000.
*/
String numberedString = convertNumToFourDigit(i);
filename = "myFileName" + numberedString + "Footer";
/*
execute the program with the respective filename.
*/
execute("MyProgram.exe " + filename);
}
This is all you'll need in your .bat file to run your program against all of the files in the current directory.
for %%I IN (*) DO ( MyProgram.exe %%I )
If the data files are in a subdirectory with an extension, here's an example.
for %%I IN (subdir\*.dat) DO ( MyProgram.exe %%I )
If you only want files in the form of x0000y, then this will do the trick.
for %%I IN (x????y) DO ( MyProgram.exe %%I )
These will process the data files in whatever order the filesystem provides their names.

Resources