Search found 11 matches

by jdicerch
28 Jul 2015 11:50
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

Meerkat wrote:I am OK now. I have no regrets :)

I am not an expert, but I am happy and enthusiastic in helping...

Meerkat



So no way to make it non-recursive? I tried changing the first line to

Code: Select all

for /D %%G in ("C:\Files\")
but that didnt seem to work
by jdicerch
28 Jul 2015 11:34
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

@echo off for /r "C:\Files\" %%a in (*) do ( for %%F in (Cory Mary Queen) do ( for /f "tokens=1,* delims=:" %%A in ( 'type "%%~a" 2^>nul^|findstr /n "%%F"^|^|echo. ' ) do ( if %%A equ 1 ( move /Y "%%~a" "C:\%%F\" ) else ( move /Y "%%~...
by jdicerch
28 Jul 2015 11:33
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

How do i put an else in here? If it doesn't match any of these, put it in "Other" folder. because all the regulars dislike having to change the code if the requirements are changed in a subsequent post if you can confirm the exact task then it would help. Which part of my post *did* you r...
by jdicerch
28 Jul 2015 10:43
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

@foxidrive Findrepl.bat is cool! Note: I am serious that I created those files (A.txt etc..) and folders (C:\Folder1 etc..) in my PC. How do i put an else in here? If it doesn't match any of these, put it in "Other" folder. the below doesnt seem to work @echo off for /r "C:\Files\&qu...
by jdicerch
28 Jul 2015 10:35
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

Meerkat wrote:@foxidrive Findrepl.bat is cool!

Note: I am serious that I created those files (A.txt etc..) and folders (C:\Folder1 etc..) in my PC.


I didn't create the appropriate folders, and i think it just deletes the file is the directory doesn't exist :P
by jdicerch
28 Jul 2015 10:29
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

Here's another way: This uses a native Windows batch script called findrepl.bat (by aacini) - download from: m and it can also be found here: http://www.dostips.com/forum/viewtopic.php?f=3&t=4697 Place it in the same folder as the batch file, or in a folder that is on the system path. @echo off...
by jdicerch
28 Jul 2015 10:29
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

Hope this helps! 0000[/code] A workaround code (sorry for its ugliness): @echo off for /r "C:\Files\" %%a in (*) do call :head "%%~a" pause exit /b 0 :head set "filename=%~1" for %%F in (Folder1 Folder2 Folder3) do ( for /f "tokens=1,* delims=:" %%A in ( 'typ...
by jdicerch
28 Jul 2015 09:57
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

Not a phrase... Just words.. The words are Mary Cory Queen
by jdicerch
28 Jul 2015 09:30
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

Could you please point out those errors? Also, i tried using forfiles but could not get it to work. The first two posts of a new poster need approval, you can post freely now. I'm happy to give code but I need to be clear about the task, because all the regulars dislike having to change the code if...
by jdicerch
28 Jul 2015 07:55
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Re: Help with batch script - FORFILES

foxidrive wrote:On a quick glance I see three errors and forfiles is not being used, as in the thread title



Can you point out the three errors?

And I meant i wanted to try and use Forfiles, but could not get it to work. Which way would you suggest?
by jdicerch
28 Jul 2015 06:24
Forum: DOS Batch Forum
Topic: Help with batch script - FORFILES
Replies: 22
Views: 18385

Help with batch script - FORFILES

So I am trying to loop through every file in a folder, and read the first line in that file. Can someone let me know what i am doing wrong, or a better way to do it? Also, the error I get says " filenamel:"' > was unexpected at this time. for /r "C:\Files\" %%a in (*) do call:hea...