Re: removing bytes from multiple files
- From: "cranberry girl" <cranberrygirl@xxxxxxxxxxxxxxxxx>
- Date: Fri, 13 Jan 2006 20:10:00 -0000
Fantastic - thanks :)
"David Candy" <.> wrote in message
news:uGsUaB9FGHA.3892@xxxxxxxxxxxxxxxxxxxxxxx
Set objShell = CreateObject("Shell.Application")
Set Ag=Wscript.Arguments
set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(Ag(0), 1, vbtrue)
A=ts.readall
B=Mid(A, 165)
ts.close
Set ts = fso.OpenTextFile(Ag(0), 2, vbtrue)
ts.write B
-------------------------------------
Put above in a new text document and rename it to something.vbs. It D E S
T R O Y S the original file so backup before running it.
Drag and drop the file to be changed over the vbs icon.
Y O U N E E D T O T E S T. This line , B=Mid(A, 165), I think takes
the 165th character (and to the end), but I can't count that high so you'll
have to test it that it snips the exact amount you want (I suspect it will
be out by one - but I can't count that high).
So TEST on a COPY of a file.
To do all jpgs in a directory assuming the vbs is named snip.vbs and is in
c:\.
For %A in ("*.jpg") do c:\snip %A
--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
"cranberry girl" <cranberrygirl@xxxxxxxxxxxxxxxxx> wrote in message
news:eVEP2W8FGHA.3532@xxxxxxxxxxxxxxxxxxxxxxx
> Erm, no - there's nothing wrong with the filenames.
>
> I need to remove the first 164 bytes from the files themselves.
>
> "Pegasus (MVP)" <I.can@xxxxxxx> wrote in message
> news:eJE2ku7FGHA.3176@xxxxxxxxxxxxxxxxxxxxxxx
>>
>> "cranberry girl" <cranberrygirl@xxxxxxxxxxxxxxxxx> wrote in message
>> news:%231JG1w6FGHA.2696@xxxxxxxxxxxxxxxxxxxxxxx
>>> I have a large number of what ought to be .jpg files that have corrupt
>>> headers.
>>>
>>> I need to remove the first x bytes from all of them (luckily it's an
>>> identical number from each!)
>>>
>>> I suppose I could do each one individually but is there an easy to use
>>> freeware app that'll let me do that on multiple files?
>>>
>>> Thanks
>>
>> You're not removing bytes from files; you're removing
>> characters from file names. This little batch file will remove
>> the first three characters from your .jpg files, provided that
>> the file names do not contain ampersands (&):
>>
>> @echo off
>> dir /b *.jpg > c:\Files.txt
>> for /F "tokens=*" %%* in (c:\Files.txt) do call :Sub %%*
>> del c:\Files.txt
>> goto :eof
>>
>> :Sub
>> set name=%*
>> echo ren "%name%" "%name:~3%"
>>
>> Remove the word "echo" from the last line to activate the
>> batch file.
>>
>>
>
>
.
- References:
- removing bytes from multiple files
- From: cranberry girl
- Re: removing bytes from multiple files
- From: Pegasus \(MVP\)
- Re: removing bytes from multiple files
- From: cranberry girl
- removing bytes from multiple files
- Prev by Date: Re: removing bytes from multiple files
- Next by Date: Re: Wallpaper
- Previous by thread: Re: removing bytes from multiple files
- Next by thread: Re: removing bytes from multiple files
- Index(es):
Relevant Pages
|