顯示具有 Command 標籤的文章。 顯示所有文章
顯示具有 Command 標籤的文章。 顯示所有文章

2024年8月14日 星期三

Copy or Backup Command - robocopy

 

robocopy D:\Backup E:\Backup /MIR /MT:100 /LOG+:C:\Logs\robocopy.log


/MIR 鏡像目錄樹(包含空的子目錄),確保目標目錄與來源目錄完全相符,並比對刪除目標中不存在於來源中的任何檔案或目錄,

/MT:100 使用100個執行緒來執行

/LOG 輸出執行狀態至記錄檔 (覆寫現有的記錄檔)

/LOG+ 輸出執行狀態至記錄檔 (附加至現有的記錄檔)


robocopy

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy


2022年9月21日 星期三

How to split large text file in windows

 If you have installed Git for Windows, you should have Git Bash installed, since that comes with Git.

Use the split command in Git Bash to split a file:

  • into files of size 500MB each: split myLargeFile.txt -b 500m

  • into files with 10000 lines each: split myLargeFile.txt -l 10000

Tips:

  • If you don't have Git/Git Bash, download at https://git-scm.com/download

  • If you lost the shortcut to Git Bash, you can run it using C:\Program Files\Git\git-bash.exe


Reference:
How to split large text file in windows
https://stackoverflow.com/questions/31786287/how-to-split-large-text-file-in-windows

2017年11月9日 星期四

Filter content in ERRORLOG log file過濾log檔案的內容

Filter content in ERRORLOG log file
過濾log檔案的內容

當你在Troubleshooting調查一個錯誤與問題時,如果ERRORLOG有大量不需要的紀錄,你可以使用以下方法來過濾。PS.當然如果你使用SSMS UI介面也是可以過濾,但用Command速度比較快一點。

1.Create a exclude text file(E:\Temp\Log\exclude.txt) with the contain below.
建立一個文字檔,填入要過濾的關鍵字,例如以下文字(每一行為一組關鍵字)
Error: 18456
Login failed for user
2.Start a Command Prompt as an Administrator and run the command below.
執行以下命令產生過濾後的ERRORLOG檔

output exclude.txt以外的資料
type E:\Temp\Log\ERRORLOG | findstr /i /v /g:E:\Temp\Log\exclude.txt > E:\Temp\Log\ERRORLOG_Filtered.log

若只想output找到的那一行
type E:\Temp\Log\ERRORLOG | findstr /i /g:E:\Temp\Log\exclude.txt > E:\Temp\Log\ERRORLOG_Filtered.log

/i   : Specifies that the search is not to be case-sensitive.

/v   : Prints only lines that do not contain a match.

/g: file   : Gets search strings from the specified file.


Reference:
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490907(v=technet.10)?redirectedfrom=MSDN

資料治理實施

資料治理實施