I have a main folder “Abc” which has about 800 sub-folders. Each of these sub-folders contains numerous files (all of the same format, say “.doc”). How do I create one master folder with all these files (and not being distributed into subfolders). I am doing this on a Windows 7 machine, using cygwin terminal.
The cp -r command copies it but leaves the files in the sub-folders, so it doesn’t really help much. I’d appreciate assistance with this. Thank you!
Assuming there could be name collisions and multiple extensions, this will create unique names, changing directory paths to dashes (e.g.
a/b/c.docwould becomea-b-c.doc). Run this from within the folder you want to collapse:If you can guarantee unique names, this will move the files and remove the subdirectories. You can change the two
.s to the name of a folder and run it from outside said folder: