Search found 244 matches

by Endoro
22 May 2013 09:07
Forum: DOS Batch Forum
Topic: Increment to text list Add prefix?
Replies: 4
Views: 2156

Re: Increment to text list Add prefix?

sed would also be a good choice:

Code: Select all

sed -i.bak "s/.*/%prefix%&/" "input.txt"
by Endoro
21 May 2013 23:27
Forum: DOS Batch Forum
Topic: Increment to text list Add prefix?
Replies: 4
Views: 2156

Re: Increment to text list Add prefix?

add a prefix to each line: @echo off &setlocal set "folder=d:\myfolder" set "prefix=JP." pushd "%folder%" set /a cnt=1001 (for /f "delims=" %%i in ('^<"input.txt" findstr /n "^"') do ( set "line=%%i" setlocal enabledelayedexpa...
by Endoro
21 May 2013 16:48
Forum: DOS Batch Forum
Topic: Splitting a text file based upon another file
Replies: 23
Views: 5733

Re: Hi All, a bit of help please

in your posted files is no match. Split before or after a match? this splits after: @echo off&setlocal set "file=file.txt" set "search=search.txt" for /f "delims=:" %%i in ('findstr /ng:"%search%" "%file%"') do set "split=%%i" (for /f &...
by Endoro
21 May 2013 14:32
Forum: DOS Batch Forum
Topic: Splitting a text file based upon another file
Replies: 23
Views: 5733

Re: Hi All, a bit of help please

sfournier wrote: based on a list I have in a different file.

the #'s in the second .TXT file are listed below.

please explain more clearly.
by Endoro
21 May 2013 11:14
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

the %startfolder% parameter not longer exist, it comes now from the "pushd" command @echo off&setlocal set "ClassID_ID_List=%~1" &rem parameter #1 set "CSVfile=%~2" &rem parameter #2 set "CSVdelim= " &rem, delimiter for output, default <tab> re...
by Endoro
21 May 2013 01:38
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

if you want to move or copy files between network ressources you (the script) need to know the network path. How to set it and store it in a variable you can see in the following shell session: C:\TEST>echo off pushd \\192.168.178.1\endoro.nas for %i in ("%cd%") do set NetPath1=%~i echo %N...
by Endoro
20 May 2013 22:53
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

@Ed Dyreen thank you for the nice explanation @sifar786 you can replace the " cd /d "%startfolder%" " command with pushd, eg.: pushd \\192.168.178.1\ressource.name This does create a new drive letter and makes it current. Put "popd" at the end of the script to remove th...
by Endoro
20 May 2013 11:04
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

I don't find the time to look inside now, but perhaps later in one of these days.
by Endoro
18 May 2013 01:15
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

@foxidrive give me one more shot, please this does not create the folders, subfolders and copy (move) the files to their respective folders. indeed, so here we go: @echo off&setlocal set "startfolder=%~1" &rem parameter #1 set "ClassID_ID_List=%~2" &rem parameter #2 s...
by Endoro
17 May 2013 15:30
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

at first, limiting the "dir" output: @echo off&setlocal set "startfolder=%~1" &rem parameter #1 set "ClassID_ID_List=%~2" &rem parameter #2 set "CSVfile=%~3" &rem parameter #3 set "CSVdelim= " &rem, delimiter for output, default <...
by Endoro
17 May 2013 13:52
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

the code for this I posted here alredy.
and later you postet other file names.
Therefore I changed the code for all filenames.
So you can now use my earlier code again.
by Endoro
17 May 2013 13:28
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14151

Re: create folders from a list and move files

Code: Select all

ClassID   ID
1   10001
1   10004
2   10002
3   10003

Yes, I understand this- but where are the file names? Do you have a list with names or a list of assignments?