Is there a way to search for files that ARE NOT *.pdf?

Discussion in 'OT Technology' started by deusexaethera, Aug 4, 2009.

  1. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    I've got a seemingly insignificant issue with some files I have to deliver to a customer; there are some extra files hidden in a godawful rats-nest of folders and subfolders, and while they won't affect anything if they get delivered along with everything else, I know they're going to do a file count and ask my why there are extra files that shouldn't be there.

    The files I need to deliver are all *.tif and *.pdf. Is there a way to search for files that DON'T match those filters? (yes, I've already deleted all the "thumbs.db" files, the file count is still too high.)
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    for /r c:\rootdirectorytobesearched %%i in (*.*) do if /i not "%%~xi"==".tif" if /i not "%%~xi"==".pdf" del "%%i"
     
  3. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Nice, thanks. Will this catch hidden files as well?
     
  4. 7960

    7960 New Member

    Joined:
    Oct 17, 2004
    Messages:
    60,415
    Likes Received:
    0
    Location:
    New England
    I'm missing something.

    Why not just search for .tif and .pdf and just copy those?
     
  5. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    You could do that too - use robocopy to retain the directory structure
     
  6. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    I don't think so - and that command works in a batch file - change the %% to % to run it at the command line.
     

Share This Page