close

Windows Server

Windows Server

PS Script For Scanning And Removing Files With Extension And Retention

– Download script at github link: 

https://github.com/vominhtri1991/PS_scanning_clearing_files_retention.git

– Structure  for running this script:

clear-files-retention.ps1 <path for scanning file> <retention days for keep file> <extension of files nedd to check>

– When running this script need passing enought 3 arguments if missing any argument script will exising without actions 

– If passing all requriment argument, in next step script will list again all value for checking and prompt Yes/No confirm to continue

– Choose Y and script will scanning and removing files with condiontion passing to arguments. List of file removed will be logged in file:

C:/tmp/clearfiles-ddMMyyyy-HHmm.log

Linux/Unix

Using CWRSYNC To Backup/Synchronization Between Linux And Window Machines

cwRsync is a packaging of Rsync(link is external) for Windows. You can use cwRsync for fast remote file backup and synchronization between Linux and Window machines.

– Download cwRsync client: https://itefix.net/cwrsync

– Add path of bin folder to PATH environment variable on Window client

– Double click cwrsync bat file to create home folder for storing ssh key pair

– Generate rsa key pair on Window client for authentication with Linux server:

– Add content id_rsa.pub of Window client to authorized_keys file on Linux server (location in home folder of user need authenticated for log on/.ssh)

– Run command rsyn to sync folder on Linux Server to Window client

rsync -r -av -e “ssh -i N:\cwrsync_6.2.0_x64_free\home\Administrator\.ssh\id_rsa” rsync_user@192.168.129.120:/source/projects /cygdrive/n/Backup/Projects

 – If Linux server change SSH default port for security hardening. On Window client need add more option to rsync command to specify port ssh service running on Linux server

Example: Change ssh port on Linux server to 2699

Command run on Window client:

rsync -r -av -e “ssh -p 2699 -i N:\cwrsync_6.2.0_x64_free\home\Administrator\.ssh\id_rsa” rsync_user@192.168.129.120:/source/projects /cygdrive/n/Backup/Projects

error: Content is protected !!