1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is there a way to get around this limitation of file names?

Discussion in 'Support' started by mathewsdw, Sep 20, 2011.

  1. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    I long ago learned not to place commas in the names of files and directories I create because (as far as I can tell) TCC has a very hard time dealing with file and directory names with commas in them in batch files. However, I have one particular directory ("C, C++") whose name predates my first installation of 4NT/Take Command/TCC many years ago and that I absolutely do not want to go into the "hassle" of changing because it is embedded in far too many (literally hundreds over 20 years) places to change at this point. So the question is simple: Is there some way I can get TCC batch files to ignore commas in the contents of variables? I've looked at the "SetDOS" command many times in the past (including just now before making this posting), and all I see are comments to the effect that you "can't use commas".
     
  2. nikbackm

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    1
    A possible work-around could be to create a junction point to the problematic directory and use that in your TCC scripts/aliases while still keeping the old name for backwards compatibility.
     
  3. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Thank you, but I have, in fact, tried that, but I can't make said batch files not see said directory and therefore not "try" to "deal with" it (again, even trying to put that name into the contents of a variable causes a real problem), and since that directory exists any "process" that "scans" the directory tree putting the names of the encountered directories into a variable array encounters problems.
     
  4. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    If it is in code, btm, or text files, then a good search and replace tool would seem the way to go.
     
  5. nikbackm

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    1
    It the directory appearing in directory listings is a problem, then maybe hiding it by setting the HIDDEN and/or SYSTEM attribute could help.

    Assuming your scripts do not always list also those kind of files/directories.
     
  6. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Dave, it is not that you are wrong (because you are not). It is more a case of trying to remember what all I've changed and what all I haven't and what all I still need to change and what all I don't is something that, as usual given my bad memory (which is no longer even slightly humorous; I've probably said this before, but without my computer and my cell phone (both of which might be called "external" memory) I would have to be institutionalized) is simply beyond my capabilities. (I will add that a very high percentage of this stuff is "archived" in .7z (like .zip but better compression) files that I only look at to update or maybe "steal" code from the programs that they contain.) Looks like I'm "stuck" with things the way they are...
     
  7. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    That makes it harder. One could perhaps write a btm or program to unzip each archive, do a search and replace, then rezip it.
     
  8. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Nik, maybe I am wrong because it was a long time ago (and my memory ain't so good), but I think I tried that (and made a "directory" whose name did not have that problem and symbolically "linked" it to the old, "bad" directory) and it just plain "broke" too many things. However, since I don't remember for sure I will try it again! Thank you!
     
  9. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    What problem are you having? I don't know of any issue with filenames containing commas. You just need to quote them -- the same as if they contained spaces.
     
  10. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Charles, to put it simply, I no longer remember. (My often-mentioned bad-memory is not a joke or an exaggeration; it is becoming an increasingly "crippling" element of of my life.) And the situation came up in the last day or two in a one-time-only use batch file that I created, ran, deleted, and no longer have. The best I can do is to try to remember the situation and save the exact code that caused the problem in the future when and if I re-post this problem. Sorry about that...
     
  11. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Nik, that did, in fact, "break" some things (including me in the sense that the directory no longer "showed up" where I expected it to which, particularly because of my bad memory, confused the heck out of me), but thank you for at least putting me on the right track!!! Setting the "Archive" attribute on the directory (I was a little bit surprised to find that directories evidently never get their "Archive" attributes set "naturally") and doing "For /A:-A" gets the job done perfectly! Again, thank you for making me "think" about it and putting me on the right track!!!
     
  12. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Charles, I no longer remember the exact details (I'll try to remember to not to keep bringing up my bad memory (if I remember to! ; > ) >), but the problem almost certainly showed up when the directory name in an "@Index" function (putting the directory name in quotes effectively causes the "@Index" function to not work at all), but another person in this thread (Nik) put me on the right track: setting the "Archive" attribute on the directory and doing "For /A:-A" gets the job done perfectly!
     
  13. nikbackm

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    1
    Good to hear.

    Nice trick with the archive attribute, seems a little similar to how Microsoft originally implemented long filenames on FAT filesystems.

    http://home.teleport.com/~brainy/lfn.htm
     

Share This Page