It uses the windows FindFirstChangeNotification which means it does use very little resources. (A nonsense benchmark, Idle time 4886h, ChkMagick 6s)
chkmagick.ini
for your needs and...
chkmagick /install
chkmagick.ini
you need to restart the service, one way isnet stop chkmagick
net start chkmagick
chkmagick.log
to find errors.
chkmagick /uninstall
chkmagick-computername.ini
it is prefered
chkmagick.ini
chkmagick.ini
does not exists, the service stops
From the [Setup] section you set defaults values for the rest of the sections.
[Setup] | Description | Default | Example |
---|---|---|---|
Root= | where all commands below resides, when no path is given | Root=c:\programs\command | |
Prio= | default process priority class, Low|Normal|High | Low=Idle_priority_class | |
SubT= | default subtree flag, 0|1 | 0=False | |
LogL= | loglevel, 0..9, when implementing a new function set to nonzero | 1 | LogL=2 |
Time= | maximum wait time for the commands below, ms | 18000=18s | |
Kill= | 0|1, terminate process if not finished within time above | 0=False | |
Sleep= | wait time after notify occurs | 1000=1s | |
File= | default filename mask in "To" directory | File=%fnh | |
MinFileSize= | the minimum filesize (bytes) to consider processing, file is moved but not processed | -1 | |
MaxFileSize= | the maximum filesize to consider processing | -1 | |
For every [Event] you need to define you define a new section as follows | |||
[Section] | Description | Default | Example |
Root= | root path for the commands in this section | [Setup]Root | |
Prio= | default process priority class, Low|Normal|High | [Setup]Prio | |
LogL= | loglevel for this section | [Setup]LogL | |
Time= | maximum wait time for this section | [Setup]Time | |
Kill= | it time is reached and not finished then kill process | [Setup]Kill | |
Sleep= | wait time for this section | [Setup]Sleep | |
MinFileSize= | minimum filesize, this section | [Setup]MinFileSize | |
MaxFileSize= | maximum filesize, this section | [Setup]MaxFileSize | |
From= | The folder/directory to listen for change, when a file is copied/created in this the process begins. MUST be a valid directory. If directory does not exist nothing will happen (a note in the chkmagick.err file) | ||
SubT= | if true listen for change in subtree of from folder | [Setup]SubT | |
To= | The folder/directory to move the file to, this directory is created if not exist. The filename uses the File= mask | To=c:\home\cm\web\upload\ref | |
File= | filename mask in the To directory | [Setup]File | File=%fnh |
Comp= | The folder/directory to check the file against.
If file exist in this directory and file is not the same
filname will increment by _n. Use this if you move files in stages between directories and want to check filename against the final destiniation. In the final stage use Dupl=1 to delete duplicate files but still process on the way. For very special uses... | ||
Exif= | Set Exif=1 to adjust filedate according to exif datetime | ||
Drop= | Set Drop=1 to delete file after commands App1..App6 is executed | Drop=0 | |
Dupl= | Set Dupl=1 to execute commands even if file already exists, file is tested with name, size and Crc32, original file is deleted | Dupl=0 | |
Cop1= | Copy a file before App1 is run Cop1=c:\dir\file.txt c:\dir\%yyyy\%fil.txt | ||
App1= | The command to run on the file | ||
Cmd1= | Parameters to the command | ||
Dir1= | The directory to run the command in | ||
Pri1= | Priority class for individual application | [Name]Prio | |
Appn= | You can use App1,App2..App6 up to six commands per file... (with Copn,Cmdn and Dirn) | ||
Ext1= | To deside by extension which directory to copy file can be a list with semicolons | .doc;.xls;.ppt | |
ToD1= | If extension in list Ext1, move to directory ToD1 | c:\home\web\office | |
Extn= | You can use Ext1..Ext6 for control. |
To, File, Comp, Cmdn, Dirn you can use the following parameters: |
A picture file taken 2005-apr-08: img_0123.jpg is dropped 2014-dec-24 in the imgref directory The section below handles the file for the "result" below [Nav-img] From=c:\home\web\web\upload\imgref To=c:\home\web\web\upload\img File=%yy%mm%dd_%fnr_%r%fc | |
%par | Description | Result |
---|---|---|
%content %fi | returns content of file | one line, (max 32kb) |
%srcpath2 %fd | returns 'source' directory the %srcpath2 vars can be refered later in a chain | %srcpath2=project_23 for c:\home\web\upload\img\project_23\ |
%srcpath3 %fdb | returns root/root directory | %srcpath3=img for c:\home\web\upload\img\project_23\ |
%srcpath4 | returns root/root/root directory | %srcpath4=upload for c:\home\web\upload\img\project_23\ |
%srcpath_id %fdd | returns last part of 'source' directory delimited by underscore | %fdd=23 for c:\home\web\upload\img\project_23\ |
%fdb | returns 'source', 'part -2' | %fdb=img for c:\home\web\upload\img\project_23\ |
%fil | the 'target' filename, without path or extension | 050408_img0123_001 |
%fpu | returns 'target' unix path | c:/home/nav/web/upload/img/ |
%fp | returns 'target' path | c:\home\web\web\upload\img\ |
%fu | returns 'target' file, unix path, no ext. | c:/home/nav/web/upload/img/050408_img0123_001 |
%f | returns 'target' file | c:\home\web\web\upload\img\050408_img0123_001.jpg |
%fnru | returns uppercase filenumber of orginal filename (max 16, se note) | IMG0123 |
%fnr | returns filenumber of orginal filename (max 16, se note) | img0123 |
%fnh | returns translated filename, only [a..z,0..9,_] | img_0123 |
%fno | returns orignal filename with extension | img_0123.jpg |
%fn | returns orignal filename without extension | img_0123 |
%fh2 | returns small hash from filename+filesize, 2 chars | AA |
%fh3 | returns small hash from filename+filesize, 3 chars | AAA |
%fh4 | returns small hash from filename+filesize, 4 chars | AAAA |
%fe | returns extension | .jpg |
%fc | returns file counter, if file exists 00..ZZ. note, that if file exists and Dupl=0 then filename appends with _n where n=1.. ex. filename_12.ext | 00 |
%random2 | returns random 00..zz | x8 |
%random3 | returns random 000..zzz | x8y |
%random4 | returns random 0000..zzzz | x8y4 |
%usr | returns current windows username | |
%resnnn | returns resolution needed to get nnn pixels (for .eps...) | -r%res600 |
%rot | returns rotation of picture file if found for .jpg,.jpeg,.tif,.tiff | -rotate 90 |
%r | returns orientation of picture file 0,6(=90),8(=-90) | 6 |
%px | returns pixel width of image | 1024 |
%py | returns pixel height of image | 768 |
%year2 | Current year, 2 digits, yy | 14 |
%year4 | Current year, 4 digits, yyyy | 2014 |
%date4 | Current date, 4 digits, yymm | 1412 |
%date6 | Current date, 6 digits, yymmdd | 141224 |
%date8 | Current date, 8 digits, yyyymmdd | 20141224 |
%date10 | Current date, 10 digits, yyyy-mm-dd | 2014-12-24 |
%time2 | Current time, 2 digits, hh | 14 |
%time4 | Current time, 4 digits, hhmm | 1445 |
%time6 | Current time, 6 digits, hhmmss | 144515 |
%time8 | Current time, 8 digits, hh:mm:ss | 14:45:15 |
%now8 | Current time, 8 digits, yymmddhh | 14122414 |
%now10 | Current time, 10 digits, yymmddhhmm | 1412241445 |
%now11 | Current time, 11 digits, yymmdd-hhmm | 141224-1445 |
%now12 | Current time, 12 digits, yymmddhhmmss | 141224144515 |
%now13 | Current time, 13 digits, yymmdd-hhmmss | 141224-144515 |
%now16 | Current time, 16 digits, yyyy-mm-dd_hh-mm | 2014-12-24_14-45 |
%now19 | Current time, 19 digits, yyyy-mm-dd_hh-mm-ss | 2014-12-24_14-45-15 |
Filedate, se note below | ||
%yyyy | Displays the year as a four-digit number (0000-9999) | 2005 |
%yy | Displays the year as a two-digit number (00-99). | |
%mmmm | Displays the month as a full name (January-December) | April |
%mmm | Displays the month as an abbreviation (Jan-Dec) | Apr |
%mm | Displays the month as a number with a leading zero (01-12) | 04 |
%m | Displays the month as a number without a leading zero (1-12) | 4 |
%dddddd | Displays the date using the format given by the LongDateFormat | |
%ddddd | Displays the date using the format given by the ShortDateFormat | |
%dddd | Displays the day as a full name (Sunday-Saturday) | |
%ddd | Displays the day as an abbreviation (Sun-Sat) | |
%dd | Displays the day as a number with a leading zero (01-31) | |
%d | Displays the day as a number without a leading zero (1-31) | |
%c | Displays the date using the format given by the ShortDateFormat, followed by the time using the format given by the LongTimeFormat | |
%hh | Displays the hour with a leading zero (00-23) | |
%h | Displays the hour without a leading zero (0-23) | |
%nn | Displays the minute with a leading zero (00-59) | |
%n | Displays the minute without a leading zero (0-59) | |
%ss | Displays the second with a leading zero (00-59) | |
%s | Displays the second without a leading zero (0-59) |
[Setup] Root=C:\Programs\ImageMagick Time=12000 LogL=2 [Nav-img] From=c:\home\web\web\upload\img To=c:\home\web\web\pic\o\%yyyy App1=convert.exe Cmd1=%f -quality 40 -thumbnail 120 %rot %fil.jpg Dir1=c:\home\web\web\pic\t\%yyyy App2=convert.exe Cmd2=%f -resize 600 %rot -interlace line %fil.jpg Dir2=c:\home\web\web\pic\s\%yyyy App3=convert.exe Cmd3=%f -resize 896 %rot -interlace line %fil.jpg Dir3=c:\home\web\web\pic\l\%yyyy App4=mogrify.exe Cmd4=-quality 60 -interlace line %f Dir4=c:\home\web\web\pic\o\%yyyy [Nav-imgref] From=c:\home\web\web\upload\imgref To=c:\home\web\web\upload\img File=%yy%mm%dd_%fnr_%r%fc App1=c:\mysql\bin\mysql.exe Dir1=c:\mysql\bin cmd1=-D test -e "INSERT img (src,extt,exts,extl,exto,ori,path,nr,dat) VALUES ('%fil','.jpg','.jpg','.jpg','%fe','%r','%yyyy','%fnru','%yyyy-%mm-%dd %hh:%nn:%ss');_ UPDATE img,imgref SET imgref.imgid=img.id,img.prjid=imgref.prjid,img.txt=imgref.txt WHERE (img.src='%fil') and (imgref.fn='%fno');_ UPDATE img SET ix=concat_ws(' ',concat('#',id),nr,'%yyyy','%yy%mm%dd',txt,src) WHERE src='%fil';"
More info/questions from: Subject: ChkMagick