On Wed, Jun 27, 2007 at 12:27:25AM +0200, Hemmann, Volker Armin wrote

> open site. Wait until flash starts to load
> ls -lhtr /tmp
> the last file, starting with FLASH is the one.
> Wait for it to be fully loaded, copy it somewhere.

  There's an automated way of doing this.  I've written a bash script
that will find flash video files in the current directory *REGARDLESS OF
THE NAME*, and move them over to a specified directory with sequential
names, i.e. mm000.flv, mm001.flv, mm002.flv, etc.  Here's the setup...

1) mkdir ~/mvflv

2) save the script below as ~/bin/mvflv and make it executable.  This
bash script is released under GPL version 2.  You don't know me, so you
may want to wade through the code to ensure that it doesn't do anything
nasty, especially in the backtick expansions.  (I originally wrote the
decrement(), increment(), and getnextversion() functions for use with my
system backups, so that they would be sequentially numbered).

3) cd to either /tmp or Firefox's Cache directory and execute mvflv
The script lists each file it moves into ~/flvfiles

##################################################################
#!/bin/bash

decrement() {
  echo $(( $1 - 1 ))
}

increment() {
  echo $(( $1 + 1 ))
}

getnextversion() {
  NUMBER=
  DIGITPOINTER=0
  while [ ${DIGITPOINTER} -lt ${1} ]
  do
    NUMBER=${NUMBER}0
    DIGIT[${DIGITPOINTER}]=0
    DIGITPOINTER=`increment ${DIGITPOINTER}`
  done
  while [ -e ${2}${NUMBER}${3} ]
  do
    DIGITPOINTER=`decrement ${1}`
    DIGITPNTLEFT=`decrement ${DIGITPOINTER}`
    DIGIT[${DIGITPOINTER}]=`increment ${DIGIT[${DIGITPOINTER}]}`
    NUMBER=
    while [ ${DIGITPOINTER} -ge 0 ]
    do
      if [ ${DIGIT[${DIGITPOINTER}]} -eq 10 ]
      then
        DIGIT[${DIGITPOINTER}]=0
        if [ ${DIGITPNTLEFT} -gt 0 ]
        then
          DIGIT[${DIGITPNTLEFT}]=`increment ${DIGIT[${DIGITPNTLEFT}]}`
        fi
      fi
      NUMBER=${DIGIT[${DIGITPOINTER}]}${NUMBER}
      DIGITPOINTER=${DIGITPNTLEFT}
      DIGITPNTLEFT=`decrement ${DIGITPNTLEFT}`
    done
  done
  echo ${2}${NUMBER}${3}
}

for filename in *
do
  if echo "`file ${filename}`" | grep "Macromedia Flash Video" ; then
    newfilename=`getnextversion 3 ~/flvfiles/mm .flv`
    mv ${filename} ${newfilename}
    echo ${newfilename}
  fi
done
##################################################################


-- 
Walter Dnes <[EMAIL PROTECTED]> In linux /sbin/init is Job #1
Q. Mr. Ghandi, what do you think of Microsoft security?
A. I think it would be a good idea.
-- 
[EMAIL PROTECTED] mailing list

Reply via email to