Batch file script to remove special characters from filenames (Windows)

Posted by njreed.myopenid.com on Stack Overflow See other posts from Stack Overflow or by njreed.myopenid.com
Published on 2008-11-04T10:54:46Z Indexed on 2010/03/12 17:17 UTC
Read the original article Hit count: 523

Filed under:
|
|
|
|

I have a large set of files, some of which contain special characters in the filename (e.g. ä,ö,%, and others). I'd like a script file to iterate over these files and rename them removing the special characters. I don't really mind what it does, but it could replace them with underscores for example e.g.

Störung%20.doc would be renamed to St_rung_20.doc

In order of preference:

  1. A DOS batch file
  2. A Windows script file to run with cscript (vbs)
  3. A third party piece of software that can be run from the command-line (i.e. no user interaction required)
  4. Another language script file, for which I'd have to install an additional script engine

Background: I'm trying to encrypt these file with GnuPG on Windows but it doesn't seem to handle special characters in filenames with the --encrypt-files option.

© Stack Overflow or respective owner

Related posts about gnupg

  • GnuPG PHP gnupg Folder & Files Permission

    as seen on Super User - Search for 'Super User'
    Situation: we plan on using PHP's GnuPG extension to encrypt/decrypt files. Currently we've setup some test cases, using keys generated with GPG. The generated files reside in: /Users/username/.gnupg/ I am able to get keyinfo for the key I want to use to encrypt/decrypt, but when I attempt to… >>> More

  • gnupg make failure

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I got errors as below when tried to make gnupg 2.0.19 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compress.o: In function `init_uncompress': /home/steve/Desktop/gnupg-2.0.19/g10/compress.c:147: undefined reference to `inflateInit_' compress.o: In function `do_uncompress': /home/steve/Desktop/gnupg-2… >>> More

  • GnuPG + Webservice + ASP.NET

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Hi! I'm exhausted. I have installed GnuPG and exported secret key, and two public keys (my own and one of my client) from another instance of GnuPG. I try to configure 'my encrypting/decrypting' method on the local machine. When I run encrypting method from a little console application it works… >>> More

  • PHP/GnuPG Decryption -- Syntax error?

    as seen on Stack Overflow - Search for 'Stack Overflow'
    I'm using php to invoke gpg, but I'm getting a pipe error. I thought that if I read in the password from a file, I could then pipe it to the command itself? But, I keep getting: Syntax error: "|" unexpected Here's the code: (Note: The files are being iterated over in a foreach loop...) foreach($files… >>> More

  • GnuPG Command Line - Verifying KeePass Signature

    as seen on Super User - Search for 'Super User'
    I'm trying to verify the PGP Signature of the latest version of KeePass 2.14's setup file against this signature, but this is the output I receive: C:\Program Files (x86)\GNU\GnuPG>gpg.exe --verify C:\Users\User\Desktop\KeePass-2.14-Setup.exe gpg: no valid OpenPGP data found. gpg: the signature… >>> More

Related posts about gpg