Answer the question
In order to leave comments, you need to log in
Node.js - child_process - How to specify not a specific file, but the file type *.doc && *.docx?
Good people, help is needed!
var exec = require('child_process').exec;
exec('AbiWord.exe —to=html testdoc.docx');
Answer the question
In order to leave comments, you need to log in
Scan a directory with files and run AbiWord in a loop, substituting file paths
As far as I understand, AbiWord only accepts one file per conversion. So it just needs to get *.doc(x) with a glob or whatever. Then call AbiWord via exec from each found file
It came out something like:
var exec = require('child_process').execFileSync;
var abi = 'brain/AbiWord/bin/AbiWord.exe';
var fs = require('fs');
var dir2read = ('test');
fs.readdir(dir2read, function(err,files){
if(err) throw err;
files.forEach(function(file){
if (!err)
exec(abi, [file, '--to=html']);
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question