Search found 475 matches

by SIMMS7400
12 Dec 2018 11:45
Forum: DOS Batch Forum
Topic: 7zip issues
Replies: 2
Views: 1161

7zip issues

Hi Folks - I'm banging my head against the wall on trying to exclude a certain directory from my archive process. SET "ASCENDDRIVE3=\\server.client.com\TM1_CDM_Data\Target" SET "PDD_ZIP_PATH=%ASCENDDRIVE3%\Archive\PDD_TO_DATAHUB_OB_FILES_%DATETIME%.zip" CALL "7z.exe" a -tzip "%PDD_ZIP_PATH%" "%ASCEN...
by SIMMS7400
10 Dec 2018 02:54
Forum: DOS Batch Forum
Topic: Batch subtraction with leading zero
Replies: 2
Views: 1099

Re: Batch subtraction with leading zero

HI Squash -

Ah yes, very easy!

This solves for my issue, but looks awfully clunky.

Code: Select all

SET "ENDYEAR=%DATAFILENAME:~-6%"
SET "ENDYEAR=%ENDYEAR:~0,2%"
SET /A "STARTYEAR=1%ENDYEAR%-1"
SET "STARTYEAR=%STARTYEAR:~1,3%"
SET "STARTPOV=Sep-%STARTYEAR%" & SET "ENDPOV=Oct-%ENDYEAR%"
by SIMMS7400
09 Dec 2018 19:01
Forum: DOS Batch Forum
Topic: Batch subtraction with leading zero
Replies: 2
Views: 1099

Batch subtraction with leading zero

Hi Folks - I am building a process that requires me to extract the year from a file name. The file name is as follows: hp_profitandloss_extract_FY08.csv The year will always be the last string preceeding the .csv. I need to extract the year and set it in a variable and also set another variable that...
by SIMMS7400
02 Dec 2018 09:28
Forum: DOS Batch Forum
Topic: Parsing taking FOREVER - possible JSCRIPT solution?
Replies: 6
Views: 1915

Re: Parsing taking FOREVER - possible JSCRIPT solution?

Another method that have not the restrictions of my previous one... @echo off setlocal EnableDelayedExpansion rem Extract desired values (for /F "tokens=2 delims=|" %%a in (FDRII_outline.txt) do ( set "value=%%~a" if "!value:~0,2!" equ "C-" echo !value! )) > out1.txt rem Sort desired values (this i...
by SIMMS7400
02 Dec 2018 08:40
Forum: DOS Batch Forum
Topic: Parsing taking FOREVER - possible JSCRIPT solution?
Replies: 6
Views: 1915

Re: Parsing taking FOREVER - possible JSCRIPT solution?

HI Shadow -

Nope, Sorting doesn't matter at all as long as the final file result has removed the duplicate(s) and the original.

Example:

Before:
1
2
3
1
1
4
5
After:
2
3
4
5
Thanks!
by SIMMS7400
02 Dec 2018 05:01
Forum: DOS Batch Forum
Topic: Parsing taking FOREVER - possible JSCRIPT solution?
Replies: 6
Views: 1915

Parsing taking FOREVER - possible JSCRIPT solution?

Hi Folks - I have a text file that consists of 85k rows. I have a need to parse that file and extract from token 2 only strings that begin with "C-" and spool those results to a file. From there, I need to remove all duplicates from that file. THe end result should be a file containing NO duplicates...
by SIMMS7400
15 Nov 2018 08:56
Forum: DOS Batch Forum
Topic: Special Chracters in file
Replies: 2
Views: 1420

Special Chracters in file

Folks - I'm trying to parse the following file: Update,Target Type,FP&A,Workforce,Real Estate,file1,file2 Update Legal Entity,TRUE,DEV,TRUE,TRUE,FALSE,REG1, test.csv However, as you can imagine, I'm not able to parse the first row due to the special chracters. I think I need to toggle between delaye...
by SIMMS7400
17 Aug 2018 04:30
Forum: DOS Batch Forum
Topic: Get newest files from a text fie list
Replies: 3
Views: 1412

Re: Get newest files from a text fie list

Hi Antonio -

Wow thank you so much! That's slicker than whale snot!!!

Have a great day!
by SIMMS7400
16 Aug 2018 13:02
Forum: DOS Batch Forum
Topic: Get newest files from a text fie list
Replies: 3
Views: 1412

Get newest files from a text fie list

Hi Folks - This is a simlar request to the one I posted the other day, however it's a bit more challenging. I have a list of files with their date modified. Is there a way to parse this to always get to the latest two files? Here is the text file: 8/1/2018 8:01:00 AM 2,112,338 Rave_Active_Trial_Site...
by SIMMS7400
16 Aug 2018 12:59
Forum: DOS Batch Forum
Topic: Get latest 2 files in directory
Replies: 2
Views: 1280

Re: Get latest 2 files in directory

Hi Steffen -

Thank you so much - this is working great!
by SIMMS7400
13 Aug 2018 14:04
Forum: DOS Batch Forum
Topic: Get latest 2 files in directory
Replies: 2
Views: 1280

Get latest 2 files in directory

Hi Folks - I have a need to grab the names of the (2) NEWEST files in a particular directory. To grab one file name, I'm using the following with success : FOR /F "delims=" %%a IN ('DIR "%OD_CMSO_OPEX_BIN%%%~A*.csv" /B /OD /A-D') DO SET "LATEST=%%~a" My thought is to find the latest then move it to ...
by SIMMS7400
02 Aug 2018 05:51
Forum: DOS Batch Forum
Topic: copy and kill file
Replies: 2
Views: 1352

Re: copy and kill file

Untested:

Code: Select all

SET "SOURCE_DIR=\\mylnadir1\dir1"
SET "DEST_DIR=\\mylnadir2\dir2"

PUSHD "%SOURCE_DIR%"
	FOR /F %%A IN ("*.txt") DO (
		IF NOT EXIST "%DEST_DIR%\%%~A" (
			COPY /Y "%%~A" "%DEST_DIR%"
			DEL /F /Q "%%~A"
		)
	)
POPD
	
by SIMMS7400
02 Aug 2018 02:17
Forum: DOS Batch Forum
Topic: Extract date from date & time string
Replies: 1
Views: 1111

Extract date from date & time string

Hi Folks - I have a text file that looks like this: "Code1"|"Alias1"|"PFR-4115-100"|"Smith, John"|"John.Smith@Emali.com"|10/5/2018 5:41:45|"Complete" "Code1"|"Alias1"|"PFR-4115-100"|"Smith, John"|"John.Smith@Emali.com"|4/5/2018 15:41:45|"Complete" I need to extract the date (6th token) and place in ...
by SIMMS7400
13 Jul 2018 07:56
Forum: DOS Batch Forum
Topic: Batch file to copy folders & files except few
Replies: 2
Views: 1256

Re: Batch file to copy folders & files except few

Pieh's suggestion is great because it's cleaner as you can include your exclusions in a file. but this also works if you dont have many:

Code: Select all

ROBOCOPY /E  "%SOURCE%" "%TARGET%" /XD Logs Errors Files /XF *.log *.err *.txt
by SIMMS7400
07 Jul 2018 19:17
Forum: DOS Batch Forum
Topic: JREPL - search based on position?
Replies: 5
Views: 2156

Re: JREPL - search based on position?

Dave - Thank you so much! Yes, it seemed to be an issue with my syntax. I'm using %%A with success! Squash - Thank you for the suggestions. I too agree it's a bit backwards. I'm amidst making changes to the process and this is just a interim version. I will be cleaning it up as you suggested. As far...