Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok I have like 15,000+ files I need to do this to.
I tried this my root directory is C:\asf> the command is: for /r %x in (*.asf) do aifdump -hr "%x" "%CD%"

but the files are going to my root directory and are being overwritten
the syntax for aifdump is aifdump.exe [Option] [ASF_path] [Texture_dump_path] any method to fix this problem is ok even if you use python or similar thank you for your help

here is a sample if you need it to work with: http://www.mediafire.com/?e9jwa3tkedilcy5

thank you for your help Michael and Bob. when i run the command it does this

C:\asf>for /r %x in (*.asf) do aifdump -hr "%x" "%~dpnx"

C:\asf>aifdump -hr "C:\asf\9\0.asf" "C:\asf\9\0"

Texture 0.dds : 2.00 KB

and then aifdump will crash. i found out that if i make the output folder before

running the command it will work so how would i rework the command to make

the directories needed before running the command for aifdump.

I figured it out i just had to change aifdump -hr to mkdir

again thank you for your help

share|improve this question
up vote 0 down vote accepted

%CD% is always going to return the directory that you was current when you ran the command; in this case that's C:\asf'. If I interpret what you're asking, you want each of them to go into a separate directory? If so you just need to build that directory name in your command.

Note, howeve,r that you cannot have a file and a folder with the same name and same parent path; for example, if you had a file named C:\asdf\asdf.asf, you cannot also make a folder named C:\asdf\asdf.asf because the path would be ambiguous.

The easiest option would be to strip off the file extension, which the for command can do for you:

for /r %x in (*.asf) do aifdump -hr "%x" "%~dpnx"

NOTE: %~dpnx is a concatenation of three modifiers, and gives the drive, path, and name (without extension) of the file name contained in the variable x.

share|improve this answer

So, I guess you want the output path to be in the same place as the source file?

for /r %x in (*.asf) do aifdump -hr "%x" "%~dpx"

The %~ is a special modifier, see for /?. If %x is C:\asf\blah\bleh\file.asf: dp indicates drive (C:) and path (\asf\blah\bleh\), making C:\asf\blah\bleh\.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .