revivalfire Posted June 15, 2008 Report Share Posted June 15, 2008 I want to get all the txt files out of a directory that has a bunch of subdirectories with txt files. For instance. C:\PLR\cats\cat1.txt C:\PLR\cats\cat2.txt C:\PLR\cats\cat2.txt C:\PLR\dogs\dog1.txt C:\PLR\dogs\dog2.txt would be copied to C:\ALL_PLR\cat1.txt C:\ALL_PLR\cat2.txt C:\ALL_PLR\cat3.txt C:\ALL_PLR\dog1.txt C:\ALL_PLR\dog2.txt When I tried it, it seems to move the subdirectory folders too. I just want all the text files copied to one directory all together without being in subdirectory heirarchy. Thanks. Quote Link to comment Share on other sites More sharing options...
MacroPolo Posted June 16, 2008 Report Share Posted June 16, 2008 I want to get all the txt files out of a directory that has a bunch of subdirectories with txt files. For instance. C:\PLR\cats\cat1.txt C:\PLR\cats\cat2.txt C:\PLR\cats\cat2.txt C:\PLR\dogs\dog1.txt C:\PLR\dogs\dog2.txt would be copied to C:\ALL_PLR\cat1.txt C:\ALL_PLR\cat2.txt C:\ALL_PLR\cat3.txt C:\ALL_PLR\dog1.txt C:\ALL_PLR\dog2.txt When I tried it, it seems to move the subdirectory folders too. I just want all the text files copied to one directory all together without being in subdirectory heirarchy. Thanks. I would suggest using the Repeat command called "Repeat with Folder". Start with the folder C:\PLR\cats\ Make sure the radio button for "Files" is selectes (as opposed to Folders). Also make sure the checkbox "Process Subfolders" is checked too. The macro will then repeat through that directory (including subfolders) and return each FILE as a variable. Then inside your repeat, have a line of code that copies the variable (File Name) to your designated directory (ie: C:\ALL_PLR). Add a 2nd repeat command for any other directories (ie: C:\PLR\dogs\). Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.