Jump to content

MXs_369

Active Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by MXs_369

  1. REM Made by Niklas Jumlin. http://blog.jumlin.com @echo off cls setLocal EnableDelayedExpansion setLocal EnableExtensions REM for safety precautions, nothing will actually run or be modified if you run this script. REM to actually make us of this script you should edit the safety variable below to "no" set safety=yes if /i "%safety%"=="no" set run=ECHO if /i "%safety%"=="no" set run=@ set yourOldFolder=C:\Cadwell\Sierra Wave\Data.Cadwell set yourNewFolder=\\nsm001\AppData\Backup\CADWELL\EMG Mesa set logfile=%AppData%\filemove_log.txt set TmpFile=%AppData%\variables.txt set debug=no REM possible formats are "mm dd yyyy", "dd mm yyyy" and "yyyy mm dd" set DateFormat=mm dd yyyy REM possible separators are - (dash), / (slash) or . (dot) set DateSeparator=- REM script dir /s /b /a:-D %yourOldFolder% > %TmpFile% for /f "Tokens=* Delims= " %%a In (%AppData%\variables.txt) Do ( REM from now on, to use variables set within this FOR loop, an expression sign (!) is needed at start and end of the variable. e.g !var! instead of %var% REM this also requires: setLocal EnableDelayedExpansion REM set a variable to modified date of the current file call set md=%%~ta REM split up dd/mm/yyyy hh:mm to yyyy, mm and dd if "%DateFormat%"=="dd mm yyyy" ( for /f "Tokens=1,2,3 Delims=%DateSeparator% " %%i In ('echo !md!') do set md=%%i& set mm=%%j& set my=%%k ) REM split up yyyy-mm-dd hh:mm to yyyy, mm and dd if "%DateFormat%"=="yyyy mm dd" ( for /f "Tokens=1,2,3 Delims=%DateSeparator% " %%i In ('echo !md!') do set my=%%i& set mm=%%j& set md=%%k ) REM split up mm/dd/yyyy hh:mm to yyyy, mm and dd if "%DateFormat%"=="mm dd yyyy" ( for /f "Tokens=1,2,3 Delims=%DateSeparator% " %%i In ('echo !md!') do set mm=%%i& set md=%%j& set my=%%k ) REM merge vars into one var call set mdate=!my! !mm! !md! REM remove spaces in mdate call set mdate=!mdate: =! REM debug1 if /i "%debug%"=="yes" ( echo CASE: echo File: %%~na echo Path: %%~pa echo Filetype: %%~xa echo Filesize: %%~za byte echo Full filepath: %%a echo Full path: %%~da%%~pa echo Modified date: !mdate! ) REM end of debug1 REM get current date, split up dd/mm/yyyy hh:mm to yyyy, mm and dd if "%DateFormat%"=="dd mm yyyy" ( for /f "Tokens=1-4 Delims=%DateSeparator%" %%i In ('date /t') Do set cd=%%i& set cm=%%j& set cy=%%k ) REM get current date, split up yyyy-mm-dd hh:mm to yyyy, mm and dd if "%DateFormat%"=="yyyy mm dd" ( for /f "Tokens=1-4 Delims=%DateSeparator%" %%i In ('date /t') Do set cy=%%i& set cm=%%j& set cd=%%k ) REM get current date, split up mm/dd/yyyy hh:mm to yyyy, mm and dd if "%DateFormat%"=="mm dd yyyy" ( for /f "Tokens=1-4 Delims=%DateSeparator%" %%i In ('date /t') Do set cm=%%i& set cd=%%j& set cy=%%k ) REM set YYYY - (MINUS) 1 year call set /a cy=!cy!-1 REM merge vars into one var call set cdate=!cy! !cm! !cd! REM remove spaces in cdate call set cdate=!cdate: =! REM debug2 if /i "%debug%"=="yes" ( echo. echo ACTION: echo "%%~nxa" is modified "!mdate!" echo If it would have been modified "!cdate!" it would be moved. echo. echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo. echo See how the action would look like? REM confirm set /p confirm=y/n?: if /i "!confirm!"=="y" ( cls echo move %%a %yourNewFolder%\olderThanOneYear%%~pa%%~nxa echo. pause cls ) REM end of confirm ) REM end of debug2 REM actual job if !mdate! LEQ !cdate! ( REM write to logfile echo. >> %logfile% echo File: %%a >> %logfile% echo Modified: !mdate! - above file is more than one year old, will be moved >> %logfile% echo New path: %yourNewFolder%\olderThanOneYear%%~pa%%~nxa >> %logfile% echo Will delete, if empty: %%~da%%~pa >> %logfile% REM create directory structure of parent directories in %yourNewFolder% path. Requires: setLocal EnableExtensions %run% mkdir %yourNewFolder%\olderThanOneYear\%%~pa REM move file to new destination %run% move %%a %yourNewFolder%\olderThanOneYear%%~pa%%~nxa REM delete parent directory if empty %run% rmdir %%~da%%~pa ) REM end of actual job ) REM end of script :exit echo. echo Logfile: %logfile% echo. EndLocal pause the original script (which is not mine just to note) is by one year REM set YYYY - (MINUS) 1 year call set /a cy=!cy!-1 REM merge vars into one var call set cdate=!cy! !cm! !cd! REM remove spaces in cdate call set cdate=!cdate: =! what do i need to change this 2 month time frame thanks,
  2. MXs_369

    ssh-fail2ban

    is there something better then fail2ban to monitor my SSH auth logs from attackers. <other than a hardware firewall no $$ to spend> i got port 22 open and forwarding to the Linux box. just curious if there something or should i stick with what i got witch work fine.
  3. MXs_369

    got a Q?

    not looking to make a new/move vm but take the vm and make it the primary OS on the other computer but i got to thinking about it with the hardware for the two boxes they would be a incompatible with the current vm configuration i was just trying to see if there was a way to take a vm make a image to install as a primary os
  4. MXs_369

    got a Q?

    i got a vm all set up and want to install it on a physical box do i need to image to vm drive or is there a way to take the vm files to make a boot CD (host it win 7 <> vm it ubuntu 9.10 <> vm it VMware player)
  5. MXs_369

    verison WIFI

    yea i kinda got that impression but just wanted to double check thx :D
  6. MXs_369

    verison WIFI

    got a Q? i know verison wifi pcmcia cards use cell tech, but can i use jasager to catch its WIFI signal or use backtrack to view the signal <> is it more secure than wifi like wpa or what not information in for a in home audit much thinks and yes i am googling it but no definitive answer
  7. look up A2 scanner the def will need to be manually updated but it runs from flash drive or click http://wareseeker.com/Security-Privacy/a-s....103.zip/202758
×
×
  • Create New...