Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ZZ_Move.btrm - SETDOS / and fixnames plugin

Apr
1,794
15
I have a zz_done.txt - a list of files, uin the attached 7z file

The included BTM is not processing the first file listed. I do not if I need to use fixnames plugin or is I need to modify the SETDOS ? any suggstions please?

Code:
SETLOCAL
  setdos /x-1256789A
  for %fn in (@ZZ_Done.txt) gosub Dofile
  setdos /x+1256789A
ENDLOCAL
QUIT

:Dofile
  echo On: %fn
  set nLoop=1
  do until not isfile "%fn"
    iff not isfile "c:\ZZ_DoneSorted\%@upper[%@ext[%fn]]_%@format[04,%nLoop]\%@filename[%fn]" then
      move /md /r "%fn" "c:\ZZ_DoneSorted\%@upper[%@ext[%fn]]_%@format[04,%nLoop]\"
    else
      set /a nLoop=nLoop+1
    endiff
  enddo
  return

Thanks all..........
 

Attachments

  • ZZ_done.7z
    297.2 KB · Views: 6
The first file has an unmatched double quote in its name. The subroutine does echo its name. When it comes to the "IF ISFILE" I have no clue what's happening or how to fix it. "IF ISFILE", "SETDOS /x-7", and double quotes don't seem to get along. It seems like ISFILE is just removing all the double quotes! [Note: I shortened the text file.]

Code:
c:\users\vefatica\desktop> d zz*
2024-01-27  12:56         304,372  ZZ_done.7z
2024-01-27  13:04             606  ZZ_done.txt

c:\users\vefatica\desktop> setdos /x-7

c:\users\vefatica\desktop> if isfile "ZZ_d"on"e.t"xt" echo 1
1
 
As a matter of fact, the double quote is not a valid character in a Windows file name. So maybe you should first figure out how that name got into the list of files (and fix that).
 
i guess I could do fixnames plugin:

Code:
[C:\ZZ_Done]fixnames /Q:%@char[34] /R:_ /S *
FixNames plugin: Missing filespec

[C:\ZZ_Done]fixnames /Q:" /R:_ /S *
FixNames plugin: Missing filespec

[C:\ZZ_Done]

Code:
[C:\ZZ_Done]plugin /i fixnames
Module:      c:\TCMD\Plugins\fixnames\FixNames.dll
Name:        FixNames
Author:      Charles Dye
Email:       [email protected]
Web:         http://charlesdye.net/plugins/fixnames.html
Description: Renames filenames containing troublesome characters
Implements:  fixnames
Version:     0.43  Build 0

Any suggestions?
 
Code:
[C:\ZZ_Done\MP4_0001]ren "WRAL_Renee_Chou_Snow_in_the_Triangle_on_March_21st!_“It....mp4" "WRAL_Renee_Chou_Snow_in_the_Triangle_on_March_21st!_It....mp4"
C:\ZZ_Done\MP4_0001\WRAL_Renee_Chou_Snow_in_the_Triangle_on_March_21st!_“It....mp4 -> C:\ZZ_Done\MP4_0001\WRAL_Renee_Chou_Snow_in_the_Triangle_on_March_21st!_It....mp4
     1 file renamed

Wonder why this worked and fixnames didn't?
 
Wonder why this worked and fixnames didn't?
It's character 34 in ZZ_done.txt but in you're snippet, it's character 8220 (a Unicode double open-quote). I suspect that, in making the list, the Unicode character was turned into it's best translation, character 34, making for an illegal file name.
 
i guess I could do fixnames plugin:

Code:
[C:\ZZ_Done]fixnames /Q:%@char[34] /R:_ /S *
FixNames plugin: Missing filespec

[C:\ZZ_Done]fixnames /Q:" /R:_ /S *
FixNames plugin: Missing filespec

[C:\ZZ_Done]

The two are equivalent; the %@char[34] is expanded before the command is executed. Either way, you're asking to replace a list of characters including the space, the forward slash, the letter R, the colon....

I'm pretty sure Vincent has the right of it. Your filename contains a Unicode character which is not significant to either the Windows file system or TCC. In generating your list (by redirecting the output of DIR?), it got smashed to an ASCII quote — which is significant to both Windows and TCC.
 
Now I'm not sure it's that simple. When I do this,

Code:
v:\> touch /c a%@char[8220]b
2024-01-28 13:08:39.435  V:\a“b

v:\> d a?b | tee ab.txt
2024-01-28  13:08               0  a“b

The Unicode character was not turned into @CHAR[34]. It actually became @CHAR[147] (0x93), "Left double quotation mark".

1706465740310.png
 
I commented out the 2 SETDOS commands and put a ON ERRORMSG QUIT command....

Code:
[C:\Users\csgal\Desktop]c:\Z_UserFiles\JPSoft\BTM_001\ZZ_DoneMove.btm
On: C:\ZZ_Done\~$ar Trek Films.rtf
TCC: (Sys) C:\Z_UserFiles\JPSoft\BTM_001\ZZ_DoneMove.btm [14]  The system cannot find the file specified.
 "C:\ZZ_Done\~$ar Trek Films.rtf"

the file does exist.... so any thoughts?
 
Check the attributes. A filename beginning with ~$ is almost certainly a temp file; it's likely to have some funky attributes set.
 
I looked at the quick help for

Code:
for %fn in (@ZZ_Done.txt) gosub Dofile

and also for

Code:
ON .....

there doesn't seem to be a way for it to INTERATE if there is an erro insider the FOR loop. Only for it to LEAVEFOR ?
 
SETDOS /X question:

I have a file with a "-" in it. what is the SETDOS /X value to set so it is not a special menaing to TCC/TCMD?

Code:
The features are:

1 All alias expansion
2 Nested alias expansion only
3 All variable expansion (includes environment variables, batch file parameters, variable function evaluation, and alias parameters)
4 Nested variable expansion only 
5 Multiple commands, conditional commands, and piping (affects the command separator, ||, &&, |, and |&)
6 Redirection (affects < , >, >&, >&>, etc.)
7 Quoting (affects back-quotes [`] and double quotes ["]) and square brackets)
8 Escape character
9 Include lists
A User-defined functions
Code:
On: C:\ZZ_Done\RTF_0001\Star_Trek_-_Strange_New_Worlds.rtf
TCC: (Sys) C:\Z_UserFiles\JPSoft\BTM_001\ZZ_DoneMove.btm [14]  The system cannot find the file specified.
 "C:\ZZ_Done\RTF_0001\Star_Trek_-_Strange_New_Worlds.rtf"
 
I don't think '-' is special.

I edited the [C:\ZZ_Done\RTF_0001\Star_Trek_-Strange_New_Worlds.rtf] to be [C:\ZZ_Done\RTF_0001\Star_Trek?_Strange_New_Worlds.rtf] and it passed the isfile test.... so "-" must be special in sme sense
 
I don’t know if it’s a typo or if it’s the root of your problem, but the file name you edited in your last post is different to the one you asked about a couple of posts earlier.

The first name has “Trek_-Strange" whereas the second one has "Trek-Strange", there’s an extra underscore in the first one. Is that the problem or is it just a typo in your post?

Edited to add: or perhaps it’s a forum thing, my post is missing underscores that I definitely typed in, I suspect because I didn’t use a code block. So I think the difference is explained as you also didn’t use a code block in your last post, but did in the earlier one. Sorry for the distraction.
 
Last edited:

Similar threads

Back
Top