July 31, 2010

cron-like job setting on Windows XP with schtasks command

Filed under: Sample code,Windows — mariojump @ 4:57 am
Tags: ,

Task Scheduler GUI on Windows XP does not appear to allow us to set a job every 5 minutes.

Instead, schtasks command allows cron-like setting.

To set a job (a batch file) to run every 5 minutes, here’s a sample command.

C:\>schtasks /Create /SC MINUTE /MO 5 /TN yourjob_every5min.bat /TR C:\yourfolder\yourbatchfile.bat


January 1, 2010

PDF to JPEG Image Conversion Shell Script

Filed under: Linux,Sample code,Shell Script — mariojump @ 5:51 am
Tags: ,

Pdfimages can generate JPEG image files from a PDF file. Each page is converted to a JPEG file.

Using pdfimages, I wrote a shell script which generates JPEG image files for all PDF files in the current directory.

$ cat

# Create an array of the PDF files in the current directory.
files=(`ls -1 *.pdf`)

# Iterate for each PDF file in the array
for file in ${files[@]}
  image_root=`echo $file |sed -e "s/\.pdf//"`
  /usr/bin/pdfimages -j $file $image_root

exit 0

December 28, 2009

Microsoft Access SQL to calculate the time from midnight in minutes, seconds, etc.

Filed under: Access,Database,Sample code,Software Development — mariojump @ 10:00 pm

MS Access SQL to find the time from the midnight.

MS Access’s timestmap values consist of integer part (number of days from
the certain date), and fractional part (e.g. 6am = 6/24 =0.25 day
from midnight.).

By using this, we can run a query like:

´╗┐my_timestamp_column – INT(my_timestamp_column) AS Time_From_Midnight,
/* note: date part will be lost */

INT((my_timestamp_column – INT(my_timestamp_column))*24*60*60) AS

INT(INT((my_timestamp_column – INT(my_timestamp_column))*24*60*60 ) /
60) AS Minutes_From_Midnight

FROM my_table_with_timestamp;

December 12, 2009

WinSCP Script – Sample

Filed under: Sample code — mariojump @ 12:00 am
Tags: ,

WinSCP has a scripting feature.
For example, if you create a batch file, which contains:

"c:\Program Files\WinSCP3\WinSCP.exe"
/script=c:\winscpscript\testscript.txt /log=c:\winscpscript\log.txt

Then, create a script file (in this example, c:\winscpscript\testscript.txt.)

# Execute with winscp.exe /script=this_filename /log=logfile.txt
option batch abort
option confirm off
# Use the ip address of your SFTP server, instead of
open sftp_login_name:the_password@

#In order to "cd" or "lcd", use these lines.
cd server_side_directory
lcd c:\client_side_directory

# Normal GET
get Get_This_File

# If you want to save as another filename:
get Get_This_File Get_This_File_local

# If you want to remove the remote file after downloading:
get -delete Get_This_File c:\client_side_directory\Get_This_File_local

# Upload sample script line
put upload_this_file remote_filename

# If you want to rename the remote filename after uploading:
mv remote_filename remote_filename_renamed


Create a free website or blog at