-1

So on the Utorrent site, it says we can rename unfinished bitcomet files and remove the .bc! extension with this batch command. But it doesn't seem to work for me.

@for /r %i in (*.bc!) do @move "%~fi" "%~dpni"

I get this error :

The following usage of the path operator in
substitution is invalid: %~dpni"

For valid formats type CALL /? or FOR /?
rename.bat was unexpected at this time.

Other people have reported success with it so it is frustrating me. I am using Windows 7 Home Premium x64

alroc
  • 27,574
  • 6
  • 51
  • 97

2 Answers2

0

in a batch file, you have to replace all %in FORparameters with %%

@for /r %%i in (*.bc!) do @move "%%~fi" "%%~dpni"
ths
  • 2,858
  • 1
  • 16
  • 21
  • Oh that worked great! Thanks a lot! I wonder why they posted it like that? Cheers! – true_blue1878 Sep 02 '14 at 13:28
  • Actually, I wonder if there is a way to make it check subfolders as well? – true_blue1878 Sep 02 '14 at 13:32
  • @true_blue1878 : The assumption was that the command would be executed directly from the prompt. The %-doubling is only required within a batch file. A batch file usually starts with an `@echo off` line, which makes the `@`s in the line you posted (and the modified line with the doubled-%s) redundant. – Magoo Sep 02 '14 at 14:40
  • I tried executing it from the prompt and that is where I copied the error from. But it also would not work from a .bat file. Is there a way to make it rename the applicable files inside the sub directories too? Cheers – true_blue1878 Sep 02 '14 at 14:49
  • the line, as written by you does work on the command prompt. my version works in a batch file. both proccess files in all subfolders. of course, you have to execute it in the root folder you want to process. yoou can specify another folder to process with `for /r "c:\other\folder" %%i...` – ths Sep 02 '14 at 16:35
  • Hi Speising, I did execute it in the folder with the .bc! files and I just got the above error. But is there a way to make it rename the files with the bc! extension in subfolders as well? Or do I have to put the batch file in each folder I need to rename files in? Many thanks.. – true_blue1878 Sep 02 '14 at 20:11
  • what can i tell you, it does work as written on my system. in all subfolders. if it doesn't for you, maybe post a screenshot of the complete test of yours. – ths Sep 02 '14 at 21:00
  • The bat does work with subfolders.. but I had messed up folder permissions and it couldn't change them. Works fine now and thanks again!! – true_blue1878 Sep 03 '14 at 14:06
0

in a batch file, you have to replace all %in FORparameters with %%

@for /r %%i in (*.bc!) do @move "%%~fi" "%%~dpni"

Also, make sure that %%i must be %%I (and upercase letter), this avoids 'confuse' the command prompt with a string option with a variable name (in this case %%I)

Community
  • 1
  • 1
Honguito98
  • 664
  • 8
  • 13