Category Archives: Intermediate

#CommandLineFu: Pull filename from path MS-Access Query

Expr1: Mid([FILEPATH],InStrRev([FILEPATH],"\")+1)

		
Advertisements

Lotus Notes NSF Repair [8.5.2]

Error: “Database is corrupt; cannot allocate space” when opening database after server upgrade.

Problem

You have recently upgraded your Domino server from a prior Domino release. When users attempt to open their mailfile on the server, however, the following error displays:

“Database is corrupt; cannot allocate space”.

Resolving the problem

This error often indicates database corruption. In this case, you may be able to work around the issue by running Fixup, Compact and Updall as follows:

  1. fixup -f (This causes Fixup to check all documents in the database.)
  2. compact -i -c -d -K (ignore errors, copy-style, delete view indexes, set large UNK table)
  3. updall -R

 

MS Access: Get Extension from File Name

 IIf(InStrRev([name],".")>0,Mid([name],InStrRev([name],".")+1),"")

Assumes a single field labeled [name] contains a filename without the leading path. Should a file not have an extension, or a period contained within the resulting value will be blank.

CommadLineFu: TIME STAMP HISTORY

A little gem I came across today in the ##linux channel on freenode.

$ export HISTTIMEFORMAT="%F %R "

Inserts a time stamp into the history command.

CommandLineFu — COPY FILES WITHOUT CHANGING ATTRIBUTES

xxcopy “k:\foo” “k:\bar” /e /tc /h /bb /k /pb /yy /oN..\barfoo.log

/e           ==           copy all files and folders recursively
/tc          ==           do not modify date and time stamps (create, mod, and access)
/h           ==           include hidden files
/bb         ==           skip file if it already exists
/k            ==           preserve source permissions
/pb         ==           display progress bar
/yy         ==           automatically reply “YES” to all prompts
/oN..\barfoo.log    ==           create a logfile in the directory above working directory named barfoo.log

( go to http://www.xxcopy.com/xcpydnld.htm to download the latest version of xxcopy )

When running my own copy jobs I typically disregard the ‘Progress Bar’ switch because it has to sit there and calculate the number of files about to be copied (useless to us geeks). Eliminating the /PB switch allows the copy process to begin immediately.

If you want to get real clever create a batch file containing a single xxcopy command for each folder that you want to copy, and create a script to launch each one individually.

Copy Script 1:
xxcopy k:\copytest1 k:\outputtest1 /e /tc /h /bb /k /yy /oNcopy00.log

Copy Script 2:
xxcopy k:\copytest2 k:\outputtest2 /e /tc /h /bb /k /yy /oNcopy02.log

Copy Script 3:
xxcopy k:\copytest3 k:\outputtest3 /e /tc /h /bb /k /yy /oNcopy03.log

Launch Copy Scripts Script:
@echo off
##create destination folder structure
xxcopy k:\copytest k:\outputtest /t
##call on individual copy scripts
start call k:\bat0.bat
start call k:\bat1.bat
start call k:\bat2.bat
start call k:\bat3.bat
start call k:\bat4.bat
start call k:\bat5.bat
start call k:\bat6.bat
start call k:\bat7.bat
start call k:\bat8.bat
##kill unnecessary shells
taskkill /im cmd.exe /f
exit

( Change video quality to HD/720p to watch in full screen )
___________________________________________________________________________________

CommandLineFu – REMOVE BATES NUMBER REFERENCE FROM OCR TEXT FILES

find . -type f -iname “*.TXT” -exec sed -i ‘s/<< …-.-…….. >>//g’ ‘{}’ \;
*Assuming original Bates number uses the following format ABC-X-01234567

Depending on how cygwin is configured be sure to convert files back to ‘DOS’ format after using sed
find . -type f -iname “*.TXT” -exec unix2dos ‘{}’ \;

The find command is good if your files are not organized in a cleanly numbered subfolder structure, or are mixed in with other file types.  Usually simply globbing will do the trick a bit faster:

sed -i ‘s/foo/bar/g’ IMAGES/00/0[0-9]/*.TXT ; unix2dos IMAGES/00/0[0-9]/*.TXT

sed == http://sed.sourceforge.net/sedfaq.html

_____________________________________________________________________________________