Quick & Easy: FDFind (FD) Examples

fdfind aka fd is a nifty tool, you can do alot with it like finding files fast and run commands on the results quick and easily

  • apt get install fd-find (Ubuntu, Raspbian, Debian...)
  • apk add fd (Alpine)
  • scoop install fd (Windows)

Search for a file in /

  • fdfind issue /
  • cat /etc/issue

find all jpg files in current folder and move them to new folder

  • mkdir newfolder
  • fdfind .jpg* . -x mv {} newfolder

find all mkv files and run a extract image script

  • nano ei.py
  • insert code below with shift + ins and then save with ctrl + o then enter
import os
import subprocess

def extract_frame(input_file):
    input_dir = os.path.dirname(input_file)
    base_name = os.path.basename(input_file).replace('.mkv', '')
    output_file = os.path.join(input_dir, f"{base_name}-thumb.jpg")
    time = "00:03:50"  # Set the desired time in HH:MM:SS format
    
    # Run ffmpeg command to extract the frame
    command = ["ffmpeg", "-ss", time, "-i", input_file, "-frames:v", "1", output_file]
    subprocess.run(command)
    
    print(f"Frame extracted and saved to {output_file}")

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: python script.py <input_file>")
        sys.exit(1)

    input_file = sys.argv[1]
    extract_frame(input_file)
  • fdfind .mkv* . -x python3 ei.py {}