Linux – Copy all files from a directory tree into one directory

command linecygwin;file-transferlinuxwindows

I'm running on Windows but have Cygwin so Windows or simple Linux versions are both OK.

My camera-phone stores images in a directory tree based on date, but still appears to name each file uniquely. I want to copy all files into one directory on my PC without all the sub-dirs. How can I do this?

Copying with sub-dir structure is easy: xcopy f:\images\*.jpg C:\Users\Me\Pictures\Phone

Best Answer

Try this in PowerShell:

dir f:\images -recurse -filt *.jpg | copy -dest C:\Users\Me\Pictures\Phone

Note: - This will overwrite files with the same name already in the destination even if resulting from this copy - Add a -verbose to the copy to see what is being copied.