Combining Folders
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a bunch of folders that have common data. I'm hoping that I can combine all of them with a script in Matlab then create a master .txt with the content. Like the unzipping command, is it possible to dump all the content of multiple folders into one location without having to do it manually? Maybe there's a perl/C script I can use instead?
i.e., Folders= content_20110506, content_20110510, content_20110620. each folder have: doc_20110506.txt, doc_20110510.txt, doc_20110620.txt.
I want to end up with one folder that has all the txt files after taking them out of the "content" folders.
Thanks.
0 Commenti
Risposte (2)
Jan
il 8 Nov 2011
If you work under Windows, I'd use the search function of the Windows Explorer to find all files insider the base folder, which match doc_*.txt. Then you can copy these files and paste them into a new folder. Under MacOS and Linux you find similar easy solutions.
Doinf this programmatically in Matlab is not hard also. There are a lot of functions in the FEX to fuind files recursively in subfolders. Move them using MOVEFILE.
0 Commenti
Daniel Shub
il 8 Nov 2011
I wouldn't use MATLAB for this. From the CLI in Linux you can do:
find ./ -type f -exec cp {} FullPathToNewDirectory \;
Assuming you are in the topmost directory for the content directories ...
I am not sure about how find works on Windows.
You can then use the same strategy for combine them:
find FullPathToNewDirectory -type f -exec echo {} >> ./master.txt \;
0 Commenti
Vedere anche
Categorie
Scopri di più su File Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!