thank you, is there a way to do that automatically with import drop (for every file except .json, .tid for example) that is then moved to external folder?
thank you, is there a way to do that automatically with import drop (for every file except .json, .tid for example) that is then moved to external folder?
I don't think so. ... but it probably should :)
-m--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5cffd3bd-f197-43a0-ad7e-1f571ae360d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
>>Maybe someday someone will develop a FF plugin that will allow TW to become a true Evernote replacement.
What are you missing exactly to consider TW as a full Evernote replacement?
var tags = "";//tags for .tid files
var fs = require( 'fs' );var path = require( 'path' );var process = require( "process" );
var moveFrom = "/volume1/web/wiki/import";var moveTo = "/volume1/web/wiki/tiddlers/src";var tiddlersPath = "/volume1/web/wiki/tids2import/";//after i run the operation i'll drop those inside tw5 and delete em
// Loop through all the files in the temp directoryfs.readdir( moveFrom, function( err, files ) { if( err ) { console.error( "Could not list the directory.", err ); process.exit( 1 ); }
files.forEach( function( file, index ) { // Make one pass and make the file complete var fromPath = path.join( moveFrom, file ); var toPath = path.join( moveTo, file ); var title = path.basename(file); title = title.replace(/\.[^/.]+$/, "");//remove .filetype fs.stat( fromPath, function( error, stat ) { if( error ) { console.error( "Error stating file.", error ); return; }
if( stat.isFile() ) console.log( "'%s' is a file.", fromPath ); else if( stat.isDirectory() ) console.log( "'%s' is a directory.", fromPath );
fs.rename( fromPath, toPath, function( error ) { if( error ) { console.error( "File moving error.", error ); } else { console.log( "Moved file '%s' to '%s'.", fromPath, toPath ); var stream = fs.createWriteStream(tiddlersPath + "/" + title + ".tid"); stream.once('open', function(fd) { stream.write("tags: " + tags + "\n"); stream.write("title: " + title + "\n"); stream.write("type: text/vnd.tiddlywiki\n\n"); var filetyperesult = file.indexOf("mp3") > -1; if(filetyperesult){ stream.write('<<mp3 "' + title + '">>'); } filetyperesult = file.indexOf("mp4") > -1; if(filetyperesult){ stream.write('<<mp4 "' + title + '">>'); } filetyperesult = file.indexOf("pdf") > -1; if(filetyperesult){ stream.write('<<pdf "' + title + '">>'); } stream.end(); }); console.log( "created '%s'.tid", title ); } } ); } ); } );} );node /volume1/web/wiki/importexternal.js