Search found 250 matches

by goodywp
08 Aug 2018 13:21
Forum: DOS Batch Forum
Topic: copy files from uncertain subfolders into another location
Replies: 9
Views: 7637

Re: copy files from uncertain subfolders into another location

aGerman wrote:
08 Aug 2018 09:26
What do you think are the modifiers ~dpn for?

Steffen
expands %G to a drive letter and path only
tried using %~nxG expands %G to a file name and extension only not working :x
by goodywp
08 Aug 2018 06:13
Forum: DOS Batch Forum
Topic: copy files from uncertain subfolders into another location
Replies: 9
Views: 7637

Re: copy files from uncertain subfolders into another location

Thank you both!!! I tried this as below and works call C:\auto_pkg_build\Scripts\single_comp\srcfg.cmd cd "C:\auto_pkg_build\Sources\Source_schemes\Tetra_Schemes\%VARSRC5%-*\%VARSRC5%" FOR /F "delims=" %%G IN ('dir /b /s *.S3S') DO ( copy %%G C:\auto_pkg_build\Sources\Source_schemes\Single_Replace\%...
by goodywp
07 Aug 2018 08:19
Forum: DOS Batch Forum
Topic: copy files from uncertain subfolders into another location
Replies: 9
Views: 7637

copy files from uncertain subfolders into another location

Hi, I need to copy all files which sit from one subfolder to another location. The issue is that I do not know how many subfolder levels under one known folder (efg) downtwards to this final subfolder, which shall have files with extension .S3S, this final subfolder name can vary depend on different...
by goodywp
26 Jul 2018 07:40
Forum: DOS Batch Forum
Topic: how to output multiple results from loop clause
Replies: 6
Views: 5454

Re: how to output multiple results from loop clause

aGerman wrote:
25 Jul 2018 15:05
Just use the space as delimiter (which is the default) and output everything after the fourth token (which is the colon).

Code: Select all

>"signfile.txt" (for /f "usebackq tokens=4*" %%a in ("need2sign.txt") do echo %%b)
Steffen
Amazing! and good to learn from you case by case.... :)
by goodywp
25 Jul 2018 15:00
Forum: DOS Batch Forum
Topic: how to output multiple results from loop clause
Replies: 6
Views: 5454

Re: how to output multiple results from loop clause

BTW, in another case, I got the string I want as above, but the first character of the string is space, can this first space also be eliminated from above? Certainly it can. But without knowing how the lines look like and what part of them you need I can't give any good advice. Steffen The file loo...
by goodywp
25 Jul 2018 14:31
Forum: DOS Batch Forum
Topic: how to output multiple results from loop clause
Replies: 6
Views: 5454

Re: how to output multiple results from loop clause

You overwrite variable base multiple times in the loop and of course only the last value is left in the variable after the loop ended. What's the reason why you think you need an additional variable? You already have the values in %%b. @echo off >"signfder.txt" (for /f "usebackq tokens=1* delims=\"...
by goodywp
25 Jul 2018 13:38
Forum: DOS Batch Forum
Topic: how to output multiple results from loop clause
Replies: 6
Views: 5454

how to output multiple results from loop clause

Hi This could be easy for you but I am not. I had a file as below Location : TELIUM3\TSA Location : TELIUM3\KIA Location : TELIUM3\TCPXCOM Location : TELIUM3\TCPXCORE Location : TELIUM3\TCPXHMI Location : TELIUM3\TCPXVEGA Location : TELIUM3\E2EE_App Location : TELIUM3\Web Platform Lock Application L...
by goodywp
20 Jul 2018 09:50
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 8425

Re: Delete lines based upon string or file

used a combination with a for / f loop and a normal for loop. in the filter file can end semicolon, comma and space. in between, however, not - as well as no special characters like & () *? <> = | " >tempFilterFile ( @ for /f "delims=" %%i in ("filterFile") do @ ( for %%j in (%%i) do @ echo %%i ) )...
by goodywp
20 Jul 2018 07:52
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 8425

Re: Delete lines based upon string or file

I tried another file as temp.txt 500011011000.S3S 500072010400.S3S and run the following code not working, any reason? findstr /v /g:temp.txt 829501.txt >updated.txt only the above removal.txt without comma working 50001101 50007201 findstr /v /g:removal.txt 829501.txt >updated.txt Works just fine....
by goodywp
19 Jul 2018 15:10
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 8425

Re: Delete lines based upon string or file

I tried another file as temp.txt

500011011000.S3S
500072010400.S3S

and run the following code not working, any reason?

Code: Select all

findstr /v /g:temp.txt 829501.txt >updated.txt
only the above removal.txt without comma working
50001101
50007201

Code: Select all

findstr /v /g:removal.txt 829501.txt >updated.txt
by goodywp
19 Jul 2018 14:08
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 8425

Re: Delete lines based upon string or file

if you use the file, without a concluding comma at the end of the line, you can also filter it with findstr /v /g:filterFile inputfile >outfile Phil Tried your code and exactly as you mentioned only work when the filterFile without a concluding comma at the end of the line... Now my case is that th...
by goodywp
19 Jul 2018 13:18
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 8425

Delete lines based upon string or file

Hi I have a file which need to delete some lines based upon some strings This file is called 829501.txt \T501-08815-0103\Application_Signing\Signed_Schemes\QA_Infra-SL_0102_Signed_T3\ .500006011000.S3S .500007011000.S3S .500008011000.S3S .500009011000.S3S .500010011000.S3S .500011011000.S3S .5000120...
by goodywp
17 Jul 2018 16:00
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 7243

Re: How to Create a File List with some modification using Simple Batch File

aGerman wrote:
17 Jul 2018 15:20
DO NOT OVERWRITE the predefined PATH variable!
You don't even need an additional variable because you already have %cd%.

Code: Select all

for /f "tokens=5* delims=\" %%a in ("%cd%") do set "base=%%b"
Steffen
Excellent! works as expected... :)
by goodywp
17 Jul 2018 14:35
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 7243

Re: How to Create a File List with some modification using Simple Batch File

The passed folder is in %~1. The %cd% variable is set automatically and contains the current working directory. Steffen I tried %cd% as below code and works but got some issue set path=%cd% for /f "tokens=1,2,3,4,5,6,7,8,9,10,11 delims=\ " %%a in ("%path%") do set base=%%f\%%g\%%h\%%i\%%j\%%k set d...
by goodywp
17 Jul 2018 13:52
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 7243

Re: How to Create a File List with some modification using Simple Batch File

From the above code, how can I add a dynamic directory level in the below set command set dir=DIRECTORY: \"%nptn%" --> set dir=DIRECTORY: \"%nptn%\subfolder" (this one for the subfolder level contents.lst) Sorry but you lost me. After the PUSHD command the current working directory is changed to th...