Here’s something I can’t figure out: When using dired to manage files, let’s say I have a top level directory with a ton of subdirectories, each with a GoPro video inside (unique name/time/date for each file name). How do I move them all at once to that top level directory for easier management/renaming? I don’t want to have to go into each directory and move them one at a time with R. Let’s say all of the files are MP4 or HEVC.

  • Bldck@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago
    find /path/to/parent/directory -type f \( -name "*.mp4" -o -name "*.hvec" \) -exec mv -t /path/to/parent/directory {} +
    

    Explanation:

    •	find /path/to/parent/directory: Start the search from the specified parent directory.
    •	-type f: Restrict the search to files (not directories).
    •	\( -name "*.mp4" -o -name "*.hvec" \): Look for files with either a .mp4 or .hvec extension.
    •	-exec mv -t /path/to/parent/directory {} +: Execute the mv command to move the found files to the specified parent directory.