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

A couple of new plugins

Discussion in 'Plugins' started by Charles Dye, Jun 9, 2011.

  1. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
  2. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    Does FixNames handle "%20" and return a space?
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Thursday, June 09, 2011 01:40 PM
    Subject: [Plugins-t-2925] A couple of new plugins


    Fortune: Displays or returns a random line from a file. Includes provisions for not repeating the last n lines returned, and for biasing the selection toward the beginning of the file.
    http://www.unm.edu/~cdye/plugins/fortune.html

    FixNames: Renames filenames containing unfortunate characters. Primitive; I may add elaborations later.
    http://www.unm.edu/~cdye/plugins/fixnames.html
     
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Yes, %nn (where nn is any two hexadecimal digits) maps to the corresponding character. (Unless that character is itself problematic, in which case you get an underscore.)
     
  4. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    Charles,

    What I would like to see in FIXNAMES is a way to see the old and new names - sort of like

    c:\> global /h /i for %fn in (whatever) ren /N "%fn" %@replace[whatever,replacement,%fn] >! d:\filelist.txt

    would generate d:\filelist.txt

    "c:\folder\sub2\what%20ever.txt" ==> "c:\folder\sub2\what ever.txt"
    no files renamed.
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Friday, June 10, 2011 10:10 PM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Yes, %nn (where nn is any two hexadecimal digits) maps to the corresponding character. (Unless that character is itself problematic, in which case you get an underscore.)
     
  5. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Adding a /N wouldn't be difficult.

    The output wouldn't necessarily be 100% correct, though. The routine which generates new names checks for existing files with the same name, and if found, modifies the new name to avoid collisions. So if there are multiple files to be renamed in the same directory, one rename can affect later ones....
     
  6. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    How about using EXIT codes if there is a collision? Or other checkable conditions? How is the new name derived if there is a collision?
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Friday, June 10, 2011 10:43 PM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Adding a /N wouldn't be difficult.

    The output wouldn't necessarily be 100% correct, though. The routine which generates new names checks for existing files with the same name, and if found, modifies the new name to avoid collisions. So if there are multiple files to be renamed in the same directory, one rename can affect later ones....
     
  7. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Okay, I've put up a new build with a couple of new options. /N disables the rename; /NF disables just the collision-check feature (you should get an error message and an exit code).
     
  8. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    Thanks for posting the revised version.... about to try some files...
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Saturday, June 11, 2011 11:12 AM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Okay, I've put up a new build with a couple of new options. /N disables the rename; /NF disables just the collision-check feature (you should get an error message and an exit code).
     
  9. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    for %fn in (@filelist_1.txt) fixnames /n "%fn"

    does not generate any messages...... filelist_1.txt was generated with:

    dir /a: /b /s /o:gen c:\*%%* d:\*%%* > d:\filelist_1.txt
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Saturday, June 11, 2011 11:12 AM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Okay, I've put up a new build with a couple of new options. /N disables the rename; /NF disables just the collision-check feature (you should get an error message and an exit code).
     
  10. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    I'll bet your file list contains single percent signs. Those are subject to variable expansion before my command ever sees them....

    You could bypass the whole file-list step by just

    Code:
    fixnames /s /n c:\*%%* d:\*%%*
    
    Personally, I'd be reluctant to allow a beta plugin to rampage over entire hard drives, even with a do-nothing option. I'd suggest testing first with dummy files, or copies of real files, in a scratch directory!
     
  11. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    Granted - but then why did it not display "File Not Found" type messages? I also tried with setdos /x-12345689 but that didn't change the output any
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Saturday, June 11, 2011 09:26 PM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Quote:
    Originally Posted by Charles G
    for %fn in (@filelist_1.txt) fixnames /n "%fn"

    does not generate any messages...... filelist_1.txt was generated with:

    dir /a: /b /s /o:gen c:\*%%* d:\*%%* > d:\filelist_1.txt

    I'll bet your file list contains single percent signs. Those are subject to variable expansion before my command ever sees them....

    You could bypass the whole file-list step by just


    Code:
    fixnames /s /n c:\*%%* d:\*%%*Personally, I'd be reluctant to allow a beta plugin to rampage over entire hard drives, even with a do-nothing option. I'd suggest testing first with dummy files, or copies of real files, in a scratch directory!
     
  12. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    There is no "File Not Found" error. It would probably be easy enough to add; but this command can recurse into subdirectories, and I don't want to see many lines of "File Not Found".
     
  13. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    [D:\SortedPics]dir /b /f /a:-d
    D:\SortedPics\3455%3B66723232%7Ffp45%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D3233347253%3C%3A%3Cnu0mrj.jpg
    D:\SortedPics\3455%3B66723232%7Ffp54%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D323334727%3A8%3A%3Anu0mrj (1).jpg
    D:\SortedPics\3455%3B66723232%7Ffp58%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D323334727%3A%3A64nu0mrj.jpg
    D:\SortedPics\3455%3B66723232%7Ffp58%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D323334727%3A%3A65nu0mrj.jpg
    D:\SortedPics\3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B7%3A9ot1lsi.jpg
    D:\SortedPics\3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B965ot1lsi.jpg
    D:\SortedPics\3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B978ot1lsi.jpg
    D:\SortedPics\3455%3B66723232%7Ffp336%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B966ot1lsi.jpg

    d:\sortedpics\fixnames /s *%%*

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B7%3A9ot1lsi.jpg":
    The filename, directory name, or volume label syntax is incorrect.

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B965ot1lsi.jpg":
    The filename, directory name, or volume label syntax is incorrect.

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B978ot1lsi.jpg":
    The filename, directory name, or volume label syntax is incorrect.

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp336%3Enu%3D3237%3E865%3E77%3A%3E9%3A%3A56%3Ba37435532%3E232425636%3B966ot1lsi.jpg":
    The filename, directory name, or volume label syntax is incorrect.

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp45%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D3233347253%3C%3A%3Cnu0mrj.jpg":
    The filename, directory name, or volume label syntax is incorrect.

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp54%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D323334727%3A8%3A%3Anu0mrj (1).jpg":
    The filename, directory name, or volume label syntax is incorrect.

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp58%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D323334727%3A%3A64nu0mrj.jpg":
    The filename, directory name, or volume label syntax is incorrect.

    FixNames plugin: Error renaming "3455%3B66723232%7Ffp58%3Dot%3E2328%3D956%3D86%3B%3D%3A9%3B47%3Ab28344623%3D323334727%3A%3A65nu0mrj.jpg":
    The filename, directory name, or volume label syntax is incorrect.



    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Sunday, June 12, 2011 10:39 AM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Quote:
    Originally Posted by Charles G
    Granted - but then why did it not display "File Not Found" type messages? I also tried with setdos /x-12345689 but that didn't change the output any

    There is no "File Not Found" error. It would probably be easy enough to add; but this command can recurse into subdirectories, and I don't want to see many lines of "File Not Found".
     
  14. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    It's that %3A, of course. I've uploaded a new build which catches that one.
     
  15. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    That seems to work like a charm. At least on the files that have a % in them and are not in %programfiles% folder. Is the fixnames.zip available by COPY /U "whatever/fixnames.zip" -
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Monday, June 13, 2011 10:57 AM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Quote:
    Originally Posted by Charles G
    [D:\SortedPics]FixNames plugin: Error renaming "3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A% 3E9%3A%3A56%3Ba37435532%3E232425636%3B7%3A9ot1lsi. jpg":
    The filename, directory name, or volume label syntax is incorrect.

    It's that %3A, of course. I've uploaded a new build which catches that one.
     
  16. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    You can download it with
    Code:
    copy "http://www.unm.edu/~cdye/dl/fixnames.zip"
    However, /U won't work with web servers because they don't supply time stamp info.
     
  17. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Charles, thank you for fixnames!
    Unfortunately my AV Agnitum Outpost Internet Security 7.1 blocks it as a virus:
    Blocked malware "Packed/MPress" (sequence) in e:\tcmd\plugins\fixnames.dll
     
  18. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Well, I must say that that's pretty dumb. But I'll put up a copy with uncompressed DLLs here: http://www.unm.edu/~cdye/dl/fixnames-u.zip
     
  19. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Thank you, it works now. I use other plugins of yours, but fixnames and fortune are the only ones that trigger my AV.
     
  20. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    I suppose that means that your antivirus does not object to UPX....
     
  21. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Dunno. Do you mean that your other plugins are compressed with UPX unlike the last two? My AV doesn't object to your other plugins (htags, HTMLDump, SafeChars, RegTools).
     
  22. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Yah. I've put up an updated build of Fortune; no changes to the code, but the 32-bit build is packed with UPX instead of MPRESS.
     
  23. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    I have the folloiwng list of files that TCC/TCMD doesn't see but CMD does. Is this something for FixNames?


    Volume in drive D is New Volume
    Volume Serial Number is 5CAD-193E

    Directory of D:\Bad_Files\JPG_001

    06/15/11 09:07 PM <DIR> .
    06/15/11 09:07 PM <DIR> ..
    11/21/06 01:00 AM 21,065 02kåtYukiA01.jpg
    11/21/06 01:00 AM 19,801 02kåtYukiA02.jpg
    11/21/06 01:00 AM 22,733 02kåtYukiA04.jpg
    11/21/06 01:00 AM 28,330 02kåtYukiA05.jpg
    11/21/06 01:00 AM 23,089 02kåtYukiA08.jpg
    11/21/06 01:00 AM 25,818 02kåtYukiA09.jpg
    11/21/06 01:00 AM 23,528 02kåtYukiA10.jpg
    11/21/06 01:00 AM 22,840 02kåtYukiA13.jpg
    11/21/06 01:00 AM 20,820 02kåtYukiA14.jpg
    11/21/06 01:00 AM 22,637 02kåtYukiA17.jpg
    11/21/06 01:00 AM 21,663 02kåtYukiA20.jpg
    11/21/06 01:00 AM 24,801 02kåtYukiA36.jpg
    11/21/06 01:00 AM 17,765 02kåtYukiA43.jpg
    11/21/06 01:00 AM 23,443 02kåtYukiA47.jpg
    11/21/06 01:00 AM 23,014 02kåtYukiA49.jpg
    11/21/06 01:00 AM 25,176 02kåtYukiA52.jpg
    11/21/06 01:00 AM 24,257 02kåtYukiA54.jpg
    09/24/05 01:00 AM 131,782 ýKðê©Ð.jpg
    19 File(s) 522,562 bytes
    2 Dir(s) 136,273,469,440 bytes free
    <<<<<<<<<<<<<<<<<<<<<< end paste
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Monday, June 13, 2011 10:57 AM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Quote:
    Originally Posted by Charles G
    [D:\SortedPics]FixNames plugin: Error renaming "3455%3B66723232%7Ffp335%3Enu%3D3237%3E865%3E77%3A% 3E9%3A%3A56%3Ba37435532%3E232425636%3B7%3A9ot1lsi. jpg":
    The filename, directory name, or volume label syntax is incorrect.

    It's that %3A, of course. I've uploaded a new build which catches that one.
     
  24. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,007
    Likes Received:
    0
    Is there any benefit to using compressed .vs. non-compressed DLLs - besides the disk space usage?
    ----- Original Message -----
    From: Charles Dye
    To: CSGalloway@nc.rr.com
    Sent: Wednesday, June 15, 2011 10:03 AM
    Subject: RE: [Plugins-t-2925] Re: A couple of new plugins


    Quote:
    Originally Posted by Stefano Piccardi
    Charles, thank you for fixnames!
    Unfortunately my AV Agnitum Outpost Internet Security 7.1 blocks it as a virus:
    Blocked malware "Packed/MPress" (sequence) in e:\tcmd\plugins\fixnames.dll

    Well, I must say that that's pretty dumb. But I'll put up a copy with uncompressed DLLs here: http://www.unm.edu/~cdye/dl/fixnames-u.zip
     

Share This Page