Auto-Combine Folder Contents
December 22, 2004 7:53 PM   Subscribe

I'm looking for a script/hack/widget/thingie that will do the following: open lots of folders and extract the files contained in said folders to one single folder. [More Inside]

Specifics: I download a lot of stuff for Sims2. Most of the downloaded files come packaged in folders. The files must be removed from their original folders and put into another folder to work in the game. I’ve Googled and searched AskMefi with no luck. It’s quite possible I don’t have the right search string. And I suppose it’s possible such a beast doesn’t exist. I do not have the knowledge to make my own script and I use XP.
posted by deborah to Computers & Internet (8 answers total)
 
You can do this trick with many archiving utilities, in particular WinZip. Just zip up the whole source directory tree, then when you extract to your destination, there should be a little checkbox in the extract dialog that says something like "Use folder names." Uncheck that. Different versions may name this differently or present it differently, but on the version I have installed, with this box unchecked, the contents are flattened to a single directory.

Be aware you'll have to resolve any duplicate filename problems; best to keep a copy of the archive around in case you overwrite something without realizing it.
posted by George_Spiggott at 8:29 PM on December 22, 2004


Best answer: I'm not entirely clear on what you want, but here's what I do when I have a bunch of files in sub-folders and want to put them all somewhere else, out of the sub-folders:

I open up the parent folder in explorer and hit the Search toolbar button. Then I hit the Search Now button without putting anything in the name fields. That will find every file in that folder and in all folders beneath it. Now you can select all the files and drag them somewhere else.
posted by smackfu at 8:30 PM on December 22, 2004


Response by poster: smackfu has earned my eternal gratitude!
posted by deborah at 8:43 PM on December 22, 2004


My method is similar. I'll search for *.rar (or whatever archive format I'm using), select all the files, right-click and choose "Extract To...", and then choose a single directory for all the extracted files.
posted by Jairus at 8:49 PM on December 22, 2004


It sounds like the previous posters have solved your particular problem pretty well.

However, if you ever want finer grained control over general archive and file handling issues and you have java installed, apache ant rocks at this sort of task.

You don't need to know any java, it uses a pretty simple XML scripting language, and java's native [zip,gzip,tar] handling is very fast. (Faster than Winzip for zipping our 180 meg, 36000 file distribution at work)

Additionally, the ant zip task allows a bunch of things that are tough in winzip, like dynamically translating the path's inside archives and merging and unmerging bunches of zip files.
posted by PissOnYourParade at 9:03 PM on December 22, 2004


Oh, and hey, I play an asshole on MeFi sometimes, but I'll whip up small ant scripts to do this sort of stuff for people if you want. They're really easy once you get the hang of it.
posted by PissOnYourParade at 9:05 PM on December 22, 2004


"find" is the right tool for this (and most other tasks involving doing anything with files).

find is included with cygwin, which also has a bunch of other useful utilities.

Once you have find installed, you can do this with a one-liner. Something like this:

find /path/to/parent/folder -type f -exec cp {} /path/to/new/folder \; -print

This will iterate over all of the files in /path/to/parent/folder and its subdirectories, and copy them all to /path/to/new/folder.
posted by Caviar at 12:30 AM on December 23, 2004


Response by poster: Thanks for the additional input.

Doing the "search" thingie is really working for me. I also like the simplicity of using something already there without adding another widget.
posted by deborah at 1:06 PM on December 23, 2004


« Older How to fix the signature on a debit card.   |   Bitbeamer, wherefore art thou? Newer »
This thread is closed to new comments.