Page 1 of 1
Recursion
Posted: 2011-05-16 14:24:48
by AdrianK_IT
I'm trying to use the recursion function (-r) in a (Windows) batch file:
-afr Drive\path\*.* acts on the whole sub-directory tree, renaming every file
-afr Drive\path\*.txt only acts on the .txt files in the specified directory.
Is this by design? Not how /s switch would work in Windows commands.
How can I specify that all .txt files should be renamed in all subdirectories?
With thanks.
Posted: 2011-05-17 08:46:42
by antp
I would have to check but it is more likely a bug...
The pattern is passed to Windows' find function to browse the folder.
But the browsing of subfolders is done in the same loop.
And as the folders do not match the pattern, they are not included anymore when using a different pattern.
I did not test, but you can do it: put a subfolder ending by ".txt" and check if then its contents is taken in account

I'll put that on my to-do list, but I do not know when I'll fix it...
If you really need that I could quickly recompile the program just for that though.
Recursion
Posted: 2011-05-17 12:20:05
by AdrianK_IT
Thanks, antp - at least I now know I haven't misunderstood the syntax!
This a great piece of software, and the answer to many of my prayers - just not my most important one, alas!
Will play around with a few batch file tricks to see if I can work round the issue pro tem (?possibly by piping output from dir /b /s).
Of course, if you'd like to drop everything, and do a rewrite just for me, that'd be wonderful ... !
Recursion
Posted: 2011-05-17 18:03:08
by AdrianK_IT
I've solved my problem for now, by launching my batch file with the sub-directory names as replaceable parameters, and looping (using 'shift') through each sub-directory in turn. This means Renamer has to run as many times as there are sub-directories, so it's not an ideal solution particularly as the number of sub-directories starts to grow.
Next task is to find a way of generating the list of sub-directories dynamically from a 'dir /b /a:d' command, so I don't have to manually update the parameter list. (This has defeated me so far - I'm a rather simple soul!)
It really would be nice if this could all be done internally in Renamer!