Search found 10 matches

by cactusman252
05 Apr 2011 12:49
Forum: DOS Batch Forum
Topic: loop a script for multiple files
Replies: 6
Views: 6565

Re: loop a script for multiple files

that was simpler than i thought it would be :shock:

Thanks a lot aGerman! You're the best
by cactusman252
05 Apr 2011 07:18
Forum: DOS Batch Forum
Topic: loop a script for multiple files
Replies: 6
Views: 6565

Re: loop a script for multiple files

Not quite. I have multiple files in the same directory and need it so the script runs for each file separately. The trick is to read the file, grab the desired string or strings, append it to the bottom of that same file, then move on to the next txt file. So a loop would be required. This does what...
by cactusman252
04 Apr 2011 09:53
Forum: DOS Batch Forum
Topic: loop a script for multiple files
Replies: 6
Views: 6565

Re: loop a script for multiple files

A sample file would look like this: Directory of Y:\Tom\Program Integration 15/09/2010 06:44 AM 2,523,556 GF (1).avi 15/09/2010 06:45 AM 58,323,282 GF (10).avi 15/09/2010 06:45 AM 34,318,466 GF (11).avi 15/09/2010 06:45 AM 993,988 GF (12).avi 15/09/2010 06:45 AM 17,037,976 GF (13).avi 15/09/2010 06:...
by cactusman252
31 Mar 2011 10:24
Forum: DOS Batch Forum
Topic: loop a script for multiple files
Replies: 6
Views: 6565

loop a script for multiple files

Is there a way to make this script run for every file in a directory. File names are random. I tried *.txt but no luck. ================================================================= for /f "tokens=2*" %%a in ('findstr /c:"File(s)" "THEFILE.txt"') do ( for /f "t...
by cactusman252
31 Mar 2011 09:28
Forum: DOS Batch Forum
Topic: how to check the file size of a file
Replies: 1
Views: 3097

Re: how to check the file size of a file

This should show you the file size of every file in that directory in bytes. And the total size of the directory. I think this is what you meant. @echo off Set /a Total=0 Set /a Size=0 echo ======================================= for /f "tokens=*" %%I in ('dir /b') do ( Call :TotalSize %%~...
by cactusman252
18 Mar 2011 06:08
Forum: DOS Batch Forum
Topic: adding numbers in a file
Replies: 2
Views: 4261

Re: adding numbers in a file

Fixed it. I had this in mind. @echo off & setlocal EnableDelayedExpansion pushd Y:\test 3 *.txt FILES for %%i in (*.txt) do call :SUM "%%i" popd goto :EOF :SUM set sum=0 for /F "tokens=1" %%j in ('type "%~1"') do ( set bytes=%%j set bytes=!bytes:,=! set /A sum+=!byt...
by cactusman252
16 Mar 2011 07:53
Forum: DOS Batch Forum
Topic: adding numbers in a file
Replies: 2
Views: 4261

adding numbers in a file

hey guys, i have a script that adds all numbers in a file and appends it to the end of that file, the content of the files looks like this: ============== 113,862 10,430,739 1,111,892 34,005 ============= Is there anyway to modify this script to automatically run for every .txt file in the directory...
by cactusman252
09 Mar 2011 10:18
Forum: DOS Batch Forum
Topic: file splitting
Replies: 16
Views: 17600

file splitting

I need to split a master text file into multiple text files based on user name. I have a script that does the job but it splits the file based on the last character instead of the user name. If the user name is repeated it needs to append to the same file. master file's content is such: ============...
by cactusman252
08 Mar 2011 14:20
Forum: DOS Batch Forum
Topic: renaming files based on content
Replies: 2
Views: 3299

Re: renaming files based on content

Directory is in the root of the Y: drive, all files are in the same directory, all with the extension of .txt This did the trick, thanks again for /f "tokens=2*" %%a in ('findstr /c:"Directory of " "*.txt"') do ( for /f "tokens=2 delims=\" %%c in ("%%b&qu...
by cactusman252
08 Mar 2011 09:47
Forum: DOS Batch Forum
Topic: renaming files based on content
Replies: 2
Views: 3299

renaming files based on content

Hey guys, totally new to batch scripting. I have tons of file that need to be renames based on the user name, which is located in the file. for example the file content is such: Directory of Y:\Bob\My Documents 14/01/2011 01:59 PM 10,411,520 MVI_1903_1.avi 1 File(s) 10,411,520 bytes The file is name...