Search found 434 matches

by SIMMS7400
17 Jul 2019 10:33
Forum: DOS Batch Forum
Topic: Display folder contents to user and allow them to pick
Replies: 1
Views: 14

Re: Display folder contents to user and allow them to pick

In doing some research, I came up with this approach which get's me 90% there: :SELECT_BACKUP SET "DOTS=..." FOR %%A IN ("Daily" "Weekly" "Monthly" "Yearly") DO ( FOR /F "delims=" %%a IN ('DIR /S /B "%BACKUPPATH%%%A"') DO ( CALL :PROCESS "%%~a" ) ) :REPEAT CLS FOR /l %%A IN (1,1,%ZIP%) DO ( IF %%A l...
by SIMMS7400
17 Jul 2019 10:03
Forum: DOS Batch Forum
Topic: Display folder contents to user and allow them to pick
Replies: 1
Views: 14

Display folder contents to user and allow them to pick

Hi Folks - I have a need to create a script that will display the folder contents from (4) different data backup folders I have. At most, there would only be 44 data files to choose from. I want the script to essentially cycle through each backup folder and display the content (with data modified) b...
by SIMMS7400
17 Jul 2019 04:15
Forum: DOS Batch Forum
Topic: Strange Issue with FOR LOOP; ignoring last record?
Replies: 3
Views: 23

Re: Strange Issue with FOR LOOP; ignoring last record?

To correct for now, I added a second sort with SORT /R.
by SIMMS7400
17 Jul 2019 04:00
Forum: DOS Batch Forum
Topic: Strange Issue with FOR LOOP; ignoring last record?
Replies: 3
Views: 23

Strange Issue with FOR LOOP; ignoring last record?

HI Folks - I have the following script created to output unique values from a list. Prior to this step, I sort a single columntext file extracted from a data-dump from one of my data bases. From here, I need to pull out any unique records. The issue is when the uniq record is the LAST record, for so...
by SIMMS7400
14 Jun 2019 02:15
Forum: DOS Batch Forum
Topic: Determine lowest & highest number from column
Replies: 1
Views: 507

Re: Determine lowest & highest number from column

I arrived at this solution, although I'm not sure if it's as efficient as it can be: @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION ( FOR %%F IN ("*.csv") DO ( REM Sort PERIOD Column in reverse order to get MAX value SET "MAX=" SET "MIN=" FOR /F "tokens=2,3 delims=," %%A IN ('SORT /R "%%F"') DO ( IF NOT ...
by SIMMS7400
13 Jun 2019 18:29
Forum: DOS Batch Forum
Topic: Determine lowest & highest number from column
Replies: 1
Views: 507

Determine lowest & highest number from column

Hi Folks - What is the easiest way to determine the lowest and highest number from a specific column? Is it JSORT? I have a csv file with (3) columns. Column (2) is the column I need to check and the numbers will range from 01 to 12. Example: State,01,2018 State,03,2018 State,05,2018 State,01,2019 S...
by SIMMS7400
09 Apr 2019 06:58
Forum: DOS Batch Forum
Topic: How to sort file contents based on pattern?
Replies: 4
Views: 354

Re: How to sort file contents based on pattern?

Ah yes, very simple using the tokens.

Code: Select all

FOR /F "tokens=2 delims=_." %%A IN ('FINDSTR /c:"%OUTBOX_BIN%%NAME%_" %FILE%') DO (
    SET "NUM=%%~A"
    IF !NUM! GTR !MAXNUM! SET "MAXNUM=!NUM!" & SET "MAXFILE=%NAME%_!MAXNUM!.log"
)
THanks!
by SIMMS7400
09 Apr 2019 01:38
Forum: DOS Batch Forum
Topic: How to sort file contents based on pattern?
Replies: 4
Views: 354

How to sort file contents based on pattern?

Hi Folks - I have a text file that looks like such: outbox/logs/PLAN - Custom_8001.log outbox/logs/PLAN - Custom_242.log outbox/logs/PLAN - Custom_243.log outbox/logs/PLAN - Custom_244.log outbox/logs/PLAN - Custom_245.log outbox/logs/PLAN - Custom_246.log outbox/logs/PLAN - Custom_40.log outbox/log...
by SIMMS7400
03 Apr 2019 17:42
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 883

Re: Lag methodology

Hi Antonio -

I see the code you posted on the new thread is a bit different than the one above - which one should be used?

Thank you!
by SIMMS7400
01 Apr 2019 18:46
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 883

Re: Lag methodology

I would like to present a simpler approach: @echo off setlocal EnableDelayedExpansion set /P "YYYYMMDD=Enter date in YYYYMMDD format: " set /P "days=Enter number of days: " set /A "DD=100+(D=YYYYMMDD%%100), YYYYMM=YYYYMMDD/100, MM=100+(M=YYYYMM%%100), YYYY=YYYYMM/100 for /L %%i in (1,1,%days%) do (...
by SIMMS7400
18 Mar 2019 18:16
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 883

Re: Lag methodology

Hi All -

Thank for the links! I'm been playing around with that but can't seem to get anything worth that would be dynamic enough. Was hoping this was a quick hit. Does anyone mind sharing an example I could extrapolate on?

Gracias!
by SIMMS7400
14 Mar 2019 05:14
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 883

Lag methodology

Hi Folks - I have a unique need to implement a lag type of methodology. For instance, I have a date variable set as such: SET "DATEVAR=31-Jan-18" I also need to set (4) additional variable that lag 4 days. For instance: SET "DATEVAR1=30-Jan-18" SET "DATEVAR2=29-Jan-18" SET "DATEVAR3=28-Jan-18" SET "...
by SIMMS7400
23 Jan 2019 16:05
Forum: DOS Batch Forum
Topic: Manipulating a variable
Replies: 2
Views: 320

Re: Manipulating a variable

I played around and got this to work, but not sure if it's the most efficient? SET "CLOUD_URL=https://planning-z552xxx1.pbcs.us2.oraclecloud.com" SET "SEARCH=test" ECHO "%CLOUD_URL%" | FINDSTR /C:"%SEARCH%" >nul 2>&1 && ( SET "FLAG=T" ) IF DEFINED FLAG FOR /F "tokens=1,3 delims=-" %%A IN ("%CLOUD_UR...
by SIMMS7400
23 Jan 2019 15:45
Forum: DOS Batch Forum
Topic: Manipulating a variable
Replies: 2
Views: 320

Manipulating a variable

Hi Folks - I have a variable defined as such: SET "CLOUD_URL=https://planning-z552xxx1.pbcs.us2.oraclecloud.com" What I need to do is if the variable above does not have the string "test" in it, I need to add it. Like such: SET "CLOUD_URL=https://planning-test-z552xxx1.pbcs.us2.oraclecloud.com" And ...