Adventure Game Studio

Community => General Discussion => Topic started by: DutchMarco on Sat 02/04/2011 15:57:14

Title: Not adventure related (well, it's a puzzle, about xcopy)
Post by: DutchMarco on Sat 02/04/2011 15:57:14
Forgive me for asking this question, but I didn't know where else to ask.

I want to copy a whole bunch of files with a given extension (say, *.txt) from a dir structure into a single directory, leaving out the directory structure.
Say,the files are in D:\aa\aab\*.* and aa\aac\*.* etc and I wanted to copy all *.txtfiles to c:\yaddayadda. I tried xcopy, but it does copy all the aab and aac directories, which I obviously don't want. I don't know how else to do this / what tool to use. BTW I'm on XP, not Windoze 6 or 6.1 (aka 7).

Since these are 40 files I don't want to do this by hand.
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: Calin Leafshade on Sat 02/04/2011 16:19:15
How about this:


for /R %f in (*.*) do copy /Y "%f" .\%~nxf


that will copy all the files from the subdirectories of your current folder into the root of your current folder.

Edit: actually i guess you should put the second term in quotes too.. although might not be needed


for /R %f in (*.*) do copy /Y "%f" ".\%~nxf"
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: Babar on Sat 02/04/2011 17:22:52
I'm not sure what language Calin is suggesting (oh, he tells me it is a dos command), but the way I do it, is using winrar, and then setting it to "Do not store paths" in the advanced options. After it is all archived, you can unrar it wherever you want.
Probably more convoluted than Calin's method, but it works :D.
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: DutchMarco on Sun 03/04/2011 12:34:35
Quote from: Babar on Sat 02/04/2011 17:22:52
I'm not sure what language Calin is suggesting (oh, he tells me it is a dos command), but the way I do it, is using winrar, and then setting it to "Do not store paths" in the advanced options. After it is all archived, you can unrar it wherever you want.
Probably more convoluted than Calin's method, but it works :D.
Thanks you all!  Yeah, I guess Calin's command would be what you'd put in a batch file, I hadn't even thought of that! Instead of going by WinRAR (which is quite a cumbersome method), I used Explorer² by Zabkat (brilliant program, BTW!), I searched for all files with a given extension, and from the resulting resultset I copied all files , by mouse, but in one go into a new dir. Not the ideal approach (to me that would be command line), but it worked.

Thanks anyway for your advice!
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: Calin Leafshade on Sun 03/04/2011 13:18:02
You don't need to put it in a batch file. You could do that command straight from the command line.
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: DutchMarco on Sun 03/04/2011 14:03:30
Quote from: Calin Leafshade on Sun 03/04/2011 13:18:02
You don't need to put it in a batch file. You could do that command straight from the command line.
Wow, I never knew there was a command called "for", I'll keep that in mind, could come in handy!
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: zabnat on Mon 04/04/2011 06:36:28
If you type "help" in you'll find out what basic commands are available. Also "help for" will help you if you need to refresh your memory how the "for" command works. :)
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: DutchMarco on Mon 04/04/2011 11:59:52
I reserved the right to type "xcopy /?"After all, xcopy is/was a DOS-tool, so if it doesn't display sufficient documentation with that command, it should just get hold of some "man" pages.  or learn to live with it.

(duh, don't I mean that I should  learn to live with... nah.)
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: Khris on Mon 04/04/2011 20:35:41
Another way would have been to search for all *.txt files in the main dir using Windows' search window, then cut and paste them.
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: zabnat on Tue 05/04/2011 07:04:58
Quote from: Khris on Mon 04/04/2011 20:35:41
Another way would have been to search for all *.txt files in the main dir using Windows' search window, then cut and paste them.
Yes, but in that way there is no puzzle. Afterwards you wouldn't really get that feel of accomplishment that you get after researching and solving a hard puzzle. ;D
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: Khris on Tue 05/04/2011 08:43:52
True, just thought I'd mention it in a thread that makes fun of the one actually decent OS by Microsoft besides XP :)
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: DutchMarco on Tue 05/04/2011 11:44:55
Quote from: Khris on Tue 05/04/2011 08:43:52
True, just thought I'd mention it in a thread that makes fun of the one actually decent OS by Microsoft besides XP :)
Which one would that be?You're not talking about DOS, are you? In all fairness, DOS was not a decent OS - no multitasking/-threading, poor security, etc. Good gaming though. And I solved teh problem by using a search in Explorer², the program that makes file management in Windoze pleasant. So a workaround that was't much of a puzzle (the bigger puzzle would have been to install Linux, and write a bash-script to do that - a much more challeniging puzzle, but with hopefully more satisfying outcome).
Title: Re: Not adventure related (well, it's a puzzle, about xcopy)
Post by: Khris on Tue 05/04/2011 12:14:31
No, not DOS, I was of course talking about Windows ME.

I use TotalCommander, the hands down best file management app in existence. The last time I opened an Explorer window was when I copied big files from one HD to another in TC and didn't want to send the copy window to the background because I wanted to be able to check the progress closely. Wait, no, I simply ran a second instance of TC :)