none
Looking for files names containing tilde character at certain place RRS feed

  • Question

  • I once used the following batch to write the names of all *.iso files in a directory and its subdirectories to a text file:

    @Echo Off
    FOR /F "tokens=*" %%i IN ('dir /b /s *.iso') DO (
    echo "%%i" "I:%%~pi")


    This worked very well. Now I would like to solve a similar, but more complex issue.

    I have a multilevel directory tree (ca. 200k files) that contains a number (probably several thousand) of files that are characterized as follows:

    - no file name extension
    - second to last character is ~ (tilde)

    These files got corrupted in a copy operation between two NAS. 

    I would like to find all these files in the tree and write their filenames to a text file. Could anyone possibly point me in the right direction?


    Sunday, September 3, 2017 3:13 PM

Answers

  • Perhaps use:

    dir /b /s *~?.

    This should list files and directories (including in subfolders) with any character(s), followed by a tilde, followed by one character, but with no extension. Use in place of the dir command (in single quotes) in your batch file.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Sunday, September 3, 2017 5:16 PM
    Moderator

All replies

  • Perhaps use:

    dir /b /s *~?.

    This should list files and directories (including in subfolders) with any character(s), followed by a tilde, followed by one character, but with no extension. Use in place of the dir command (in single quotes) in your batch file.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Sunday, September 3, 2017 5:16 PM
    Moderator
  • thanks a lot, Richard

    super simple and worked like a breeze

    Tuesday, September 5, 2017 3:49 PM