I have a large external with many subfolders that I want to move all videos, pictures, and music to another hard-drive, what would be the best way to do this?
I would try something like..
You have to add every extension you want to search for in the regex if you want to do it all in one shot.
Or if you simply want to move the directories, you could use,
for each directory containing your media files.
I'm not really sure you want to move many files from many directories but here's the basic command for finding files of multiple extensions in one directory structure:
You'll obviously want to tack more
And that'll move them all into the specified directory.
A Bashier way of doing this would be using a few globbing modifiers (
I highly recommend the program FreeFileSync. It is great for not only syncing two directories, but also for the task you have in mind. You can add filters to include or exclude patterns. First you just browse to the origin on the left and the destination on the right. Then click compare to search through all your files. Finally click on the red funnel at the top to edit the filters.
For the filters, you place each pattern on a new line. You can replace the
Or, if you leave the
Once you make your changes and close the filter dialog, files that aren't going to be moved will be grayed out. The buttons at the bottom next to "Select View:" allow you to change what files are displayed (these buttons don't affect what files are going to be moved). Displaying only the "Do nothing" files by having only the gray bar selected, look for any you want to be moved that aren't going to be, and modify filters accordingly. Likewise, displaying only the files to be moved by having only the green arrow selected, look for any that would be moved but you don't want to be and modify filters accordingly.
You could use a simple python script to do the job:
Paste the code above in an empty textfile, enter the target- and source directories, enter the file extensions you want to move, save it as
To avoid overwriting possible duplicates (and rename them)
If there is a risk that the directory contains duplicates (names) that you want to keep, the code is a bit more extensive:
In this case, multiple occasions of