Saturday, April 19, 2014

Re: automatically editing many .tec files

Hi Asaf,

On Sat, 19 Apr 2014 02:45:13 -0700 (PDT)
אסף חיים פרייס <preiss.asaf@gmail.com> wrote:

> Hi there,
> I've many .tec files that been created after mistakly deleting photos on my
> android. I'm trying to edit them, by deleting the 6 first chrs. and the last
> one. Then, I'm changing the file from .tec to .jpg.
> I have 3000 files!!!
> Is there any way to make it automatically, like a script or cmd commands?

Yes, there is. You can use the following Bash+Perl command:

find . -name '*.tec' | (while read fn ; do
perl -n -0777 -e 'print substr($_,6,-1)' "$fn" > "${fn%%.tec}.jpg" ;
done)

Untested!

(This snippet of code can be freely reused under the MIT/X11 License / Public
Domain (CC0) )

Regards,

Shlomi Fish

--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

Cast your bread upon the waters, for after many days you will find it again.
— Ecclesiastes 1:11

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment