Find the answer to your Linux question:
Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By Rubberman
Hi, I've got a folder filled with flv files and I need to run "flvtool2 -U nameofthecurrentfile" for each file, how can I achieve this ?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2013
    Posts
    34

    command for each file


    Hi, I've got a folder filled with flv files and I need to run "flvtool2 -U nameofthecurrentfile" for each file, how can I achieve this ?

  2. #2
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    779
    I recommend copying one or two files to another directory before trying:
    ls | grep .flv | xargs flvtool2 -U

    ls = list files in directory.
    | = pipe output of that command to subshell
    grep .flv = search the output of ls for strings (in our case, files) that contain .flv
    xargs = take output of last command and submit to the command that follows, for each input submitted.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,159
    Quote Originally Posted by umbloaded View Post
    Hi, I've got a folder filled with flv files and I need to run "flvtool2 -U nameofthecurrentfile" for each file, how can I achieve this ?
    Code:
    find dirname -type f -iname '*.flv' -exec flvtool2 -U {} \;
    mizzle likes this.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Just Joined!
    Join Date
    Feb 2013
    Posts
    34
    Is it possible to run that command on all files except the first 100 ?

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,159
    Quote Originally Posted by umbloaded View Post
    Is it possible to run that command on all files except the first 100 ?
    Not inline as I showed. You could use the -exec option/command to output the data to a script where you can do that easily enough.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •