2016년 11월 2일 수요일

유용한 Windows Command

clip
fsutil
sort
tasklist
timeout
typeperf
tzutil

2016년 10월 17일 월요일

자주쓰는 SELinux 설정

ls -Z /home/

# > system-config-selinux
# > yum install policycoreutils-gui

X Window
# > semanage permissive -a xauth_t

Samba
# > chcon -t samba_share_t /dir/to/share
# > setsebool -P samba_enable_home_dirs 1
# > setsebool -P samba_export_all_rw on

2016년 5월 13일 금요일

PowerShell를 활용한 Access DB에 텍스트 데이터 가져오기

db.ps1

Set-Location $PSScriptRoot

Add-Type -TypeDefinition @'
    public enum AcTextTransferType{
        acImportDelim,
        acImportFixed,
        acExportDelim,
        acExportFixed,
        acExportMerge,
        acLinkDelim,
        acLinkFixed,
        acImportHTML,
        acExportHTML,
        acLinkHTML
    }
'@

$app = (New-Object -ComObject ACCESS.Application)
$app.OpenCurrentDatabase("k.accdb", $false, "")
#$app.Visible = $true
#도구 > 보안센터 > 보안센터설정 > 매크로설정 > 모든매크로포함
Measure-Command { $app.DoCmd.RunSQL("DELETE FROM T1") }
#IMPORT-A = 외부데이터 > 텍스트파일 > 데이터의 원본 및 대상 선택 > 텍스트 데이터 가져오기 > 고급 > 다른 이름으로 저장
Measure-Command { $app.DoCmd.TransferText([AcTextTransferType]::acImportDelim, 'IMPORT-A', "T1", ".\a.txt", $false) }
$app.CloseCurrentDatabase();

#도구 > 현재 데이터베이스 > 닫을 때 압축
#Remove-Item -Path '~k.accdb' -Force
#$app.CompactRepair('k.accdb', '~k.accdb', $false)
#Remove-Item -Path 'k.accdb' -Force
#Rename-Item -NewName 'k.accdb' -Path '~k.accdb'

$app.Quit()

Clear-Variable app