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.
I know this is the emacs subreddit but I think it would be a better task for just the CLI ‘find’ command with mindepth and exec
I use:
I’m saving that snippet for later use. Thank you.
I can think of two options:
M-x find-dired RET RET RET
(or adjust query): which will list all files recursively in dired. You probably don’t need to copy them elsewhere for renaming. UseM-x dired-toggle-read-only
(orC-x C-q
), rename in-place, and commit (toggle againC-x C-q
). https://xenodium.com/batch-renaming-with-counsel-find-dired-and-wdireddired-subtree
: enables drilling down to multipe subdirectories from the same dired buffer. Expand the subdirectories needing management, and edit like 1. (viaC-x C-q
) https://xenodium.com/drill-down-emacs-dired-with-dired-subtree
Edit: markup
I dunno, sounds like a one liner in cli … unless you need to do this many times in the future or just want to force it into Emacs for fun (which is okay :), strikes me as a 10s thing to do on cli if you’rr a Mac or Unix-like user
cd /to/top mv */*mov .
Repeat for other file type.
That assumes they’re only one level deep
Another one liner …
find /top -name “*mov” -exec “mv {} /top” ;
Be careful as just tapping out on phone but you get the idea
You could use
M-x find-name-dired
to list the files matching a pattern in the directory and subdirectories in a Dired buffer. See: https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired-and-Find.htmlThe manual also says that you could use the recursive flag for
ls
, but I’ve never tried it. See: https://www.gnu.org/software/emacs/manual/html_node/emacs/Subdirectories-in-Dired.html