Hi all. I'm trying to create a .bat file, which will search for a specific file type in a tree(hundreds of folders), and copy all those to a folder named with current date(which will need to be created). Any ideas on how I should do?

I have done a lot of similar functions in OpenVMS, but I don't know how to do it in Windows...

Recommended Answers

All 5 Replies

Member Avatar for iamthwee

I could program that. Gimme tens minutes and I'll zip up a file for you.

Sounds good. Countdown begins now..... Just paste the code into a reply in the thread.

Seems like this is something everyone should know, but I seem to develop somekind of allergic reaction when working with Windows...

Member Avatar for iamthwee

hmmm, I couldn't actually think of a way to do that with batch files.

The best I could come up with was:-

xcopy /s c:\stuff\*.txt c:\tempFolder

Which would copy all the .txt files from the folder stuff (and all its sub-folders) into the folder tempFolder.

However, it also copies the tree structures as well. Maybe I'm missing something.

Member Avatar for iamthwee

I mean, I could code something with the windows API to recurse through your directories and do exactly what you want but it's a little more effort.

Alright. But it seems like I solved though.

I managed to create a folder with todays date, and make a recursive search through my folders, copying only the files with the latest changes with the /d: swith, or make a complete backup through an exellent user-interface.

All thanks to the nice help in cmd....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.