Re: removing bytes from multiple files

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
>>
>>
>
>


.



Relevant Pages

  • Re: removing bytes from multiple files
    ... > You're not removing bytes from files; ... > characters from file names. ... This little batch file will remove ... > Remove the word "echo" from the last line to activate the ...
    (microsoft.public.windowsxp.general)
  • Re: removing bytes from multiple files
    ... > I have a large number of what ought to be .jpg files that have corrupt ... characters from file names. ... This little batch file will remove ... Remove the word "echo" from the last line to activate the ...
    (microsoft.public.windowsxp.general)
  • Re: Viruss in images?
    ... File extensions mean very little when it comes to ... I made a simple batch file with only one command, ... to open it with the program associated with jpg files, ... Sed quis custodiet ipsos Custodes? ...
    (comp.security.firewalls)
  • Re: wierd batch file behavior
    ... This is not weird batch file behaviour, as you should always expect trouble ... when dealing with special characters. ... net localgroup Administrators /add Admin /domain ...
    (microsoft.public.windows.server.scripting)
  • Re: Alan - Scottish frugality
    ... I half-recall an exchange between characters somewhere in Neal ... Stephenson's massive 'Baroque Cycle'. ... As he's removing his 17th or ... 18th century reusable sheepgut condom, ...
    (sci.military.naval)