Windows 10: Delete everything but picture files from a directory structure?

Discus and support Delete everything but picture files from a directory structure? in Windows 10 Support to solve the problem; Got an odd request, anyway to delete everything but picture files from a directory structure ? 64233 Discussion in 'Windows 10 Support' started by ZippyDSMlee, Sep 18, 2016.

  1. Delete everything but picture files from a directory structure?


    Got an odd request, anyway to delete everything but picture files from a directory structure ?

    :)
     
    ZippyDSMlee, Sep 18, 2016
    #1

  2. What can I do with File Explorer Search Results?

    No, remember, I said EVERYTHING (data/files/etc.) is stored on external drive and therefore it is E:/2016 System so it is a directory. From there the major sub-directories are:

    GRs File

    Spirit Hill

    My Downloads

    My Pictures

    That is it. OF course within each sub-directory, there many more sub-directories and same on down and down and down.
     
    TemporaryUser0101, Sep 18, 2016
    #2
  3. specify skydrive folder photos upload to?

    Same question here. My Nokia Lumia 920 insists on uploading any pictures I take to Skydrive\Pictures 1\Camera Roll. I assume the "Pictures 1" is because I already have a Pictures directory under my Skydrive cloud location and it's not smart enough to use
    it. I even tried moving the Camera Roll location from that "Pictures 1" location to the Pictures directory, but no luck.

    Normally, I'd just write this off as a standard irritation. But, from the troubles my wife's having accessing that shared Pictures location, it looks like the existence of the "Pictures 1" directory keeps her from opening "Pictures." Until I delete "Pictures
    1" all she gets when she tries to open Pictures is a note saying:

    "This item might have been deleted, expired, or you might not have permission to access it. Contact the owner of this item for more information."

    The directory also shows zero files/subdirectories under it. As soon as "Pictures 1" is gone, she can access Pictures (though it still shows zero files/subdirectories under it).
     
    oreveredrist, Sep 18, 2016
    #3
  4. cereberus Win User

    Delete everything but picture files from a directory structure?

    Select all picture files in explorer, right click and select properties. Mark them as hidden, delete remaining files, and then unhide the files and remove hidden attribute.

    You may have to do this by directory.
     
    cereberus, Sep 18, 2016
    #4
  5. Mmmmmm command line should be able to select a wild cards, tho I am unsure if you can string them together. Not sure if you can exempt this and delete that and keep folders but delete empty folders LOL
     
    ZippyDSMlee, Sep 18, 2016
    #5
  6. dalchina New Member
    Hi, if this is only required once, and there aren't too many subfolders, a relatively simple way might be to use an image viewer. That automatically picks out all image files of types it supports.

    View the folder in the image viewer, mark all as hidden. (Borrowing @Cerberus idea)
    Delete the remainder in file explorer, unhide the images.

    Repeat for all other folders.

    I'm not sure if you're looking for a script to do this repeatedly.
    If so, you could possibly do that with a viewer you can use from the command line e.g.
    PictView - image viewers and converters
    - but I can't see what the command line options are for that!
     
    dalchina, Sep 18, 2016
    #6
  7. Code: Loop, x:\RootFolder\*.*, 0,1 ; x = drive letter - 1 = search subfolders { if (A_LoopFileDir = A_WinDir) continue if A_LoopFileExt not in bmp,gif,jpg,png ; add other image extensions as needed FileDelete, %A_LoopFileLongPath% }[/quote]
    You can download AutoHotkey free programming tools from AutoHotkey


    It may be a good idea to build in a sanity check to make sure the root folder does not contain the Windows folder or any folder with other files that should not be deleted. The code I pasted is just a quickie starting point. On the AHK site you can download tools including an IDE that can wrap the script and interpreter into an exe so that the program will run on machines that do not have AHK installed.


    Enjoy *Smile

    Edit: I added an If statement to skip to the next loop if the current folder is the Windows folder as example how it is done. The forums for autohotkey are populated with regular posters who enjoy helping people with their scripts. So just visit the "ask for help" forum there for enahancements.
     
    MilesAhead, Sep 18, 2016
    #7
  8. Delete everything but picture files from a directory structure?

    You can download AutoHotkey free programming tools from AutoHotkey


    It may be a good idea to build in a sanity check to make sure the root folder does not contain the Windows folder or any folder with other files that should not be deleted. The code I pasted is just a quickie starting point. On the AHK site you can download tools including an IDE that can wrap the script and interpreter into an exe so that the program will run on machines that do not have AHK installed.


    Enjoy *Smile

    Edit: I added an If statement to skip to the next loop if the current folder is the Windows folder as example how it is done. The forums for autohotkey are populated with regular posters who enjoy helping people with their scripts. So just visit the "ask for help" forum there for enahancements.[/quote] I'll give it a go, its mainly all just a recovery of a WinXP hard drive, they want the pictures on CD's(5 or 6 in all I think) of all things, so I need to pair it down some. I think one I get down to pictures I will remove the 0-10KB ones then check and make sure the rest are half viewable. Not having a bit of luck with picture repair programs or hex editing the headers. Blah oh well some are there and working at least.

    Recovery of the hard drive on a USB hard drive(secondary documents and stuff they can get to if they want), plus pictures on CD plus all pictures on a DVD(dvds are nice I like dvds LOL).
     
    ZippyDSMlee, Sep 18, 2016
    #8
  9. Ah, in that case I feel much better. No worries about hosing a running system. AHK syntax can be weird on some of the older built in functions. But it can be great for doing file stuff simply. I wrote a utility to delete every index.dat file on the system drive in 7 lines of code. You could do the same thing with a command line batch but the AHK runs much smoother.
     
    MilesAhead, Apr 4, 2018
    #9
Thema:

Delete everything but picture files from a directory structure?

Loading...
  1. Delete everything but picture files from a directory structure? - Similar Threads - Delete everything picture

  2. I'm trying to display the structure of your file system directory

    in Windows 10 Network and Sharing
    I'm trying to display the structure of your file system directory: Here the script but showing errorimport osroot = os.path.join'..', 'panda'for directory, subdir_list, file_list in os.walkroot: print'Directory:', directory for name in subdir_list: print'Subdirectory:', name for name in file_list: print'File:', name printAnyone help what was...
  3. I'm trying to display the structure of your file system directory

    in Windows 10 Gaming
    I'm trying to display the structure of your file system directory: Here the script but showing errorimport osroot = os.path.join'..', 'panda'for directory, subdir_list, file_list in os.walkroot: print'Directory:', directory for name in subdir_list: print'Subdirectory:', name for name in file_list: print'File:', name printAnyone help what was...
  4. I'm trying to display the structure of your file system directory

    in Windows 10 Software and Apps
    I'm trying to display the structure of your file system directory: Here the script but showing errorimport osroot = os.path.join'..', 'panda'for directory, subdir_list, file_list in os.walkroot: print'Directory:', directory for name in subdir_list: print'Subdirectory:', name for name in file_list: print'File:', name printAnyone help what was...
  5. File Structure

    in Windows 10 Gaming
    File Structure: Evidently, I am not alone in trying to understand Windows 11 file structure. I have OneDrive for Cloud storage. Took me a while to realize that "myname-Personal" file was the OneCloud file. I'm OK with this now for OneCloud, but I am thoroughly confused about the file...
  6. File Structure

    in Windows 10 Software and Apps
    File Structure: Evidently, I am not alone in trying to understand Windows 11 file structure. I have OneDrive for Cloud storage. Took me a while to realize that "myname-Personal" file was the OneCloud file. I'm OK with this now for OneCloud, but I am thoroughly confused about the file...
  7. How to prevent deletion of files in directory?

    in AntiVirus, Firewalls and System Security
    How to prevent deletion of files in directory?: Using Windows Version 2004 (OS Build 19041.804) I followed these steps but without success: 1. At the root of a non-system drive create a folder "folder". 2. Inside create a file "file.txt". 3. For folder add permission rule: everyone / deny / delete subfolders and files:...
  8. Deleting EVERYTHING from pc

    in Windows 10 Installation and Upgrade
    Deleting EVERYTHING from pc: I have a Lenovo Ideapad 310 15-ABR I want to donate it to a school so they can give it to a pupil. I need to delete everything but leave the Windows 10 on it. I looked a video that said press the novo button which was either near the start button or on the left side. There is...
  9. Everything in my "Pictures" folder suddenly was deleted.

    in Windows 10 BSOD Crashes and Debugging
    Everything in my "Pictures" folder suddenly was deleted.: My computer has Windows 10 installed in it I can't find any solution anywhere. They say "look into your onedrive folder" but theres nothing there either. There is nothing in the recycle bin. There is nothing in the "restore previous versions". When I try to go after a...
  10. Relocating Pictures directory.

    in Windows 10 Support
    Relocating Pictures directory.: I installed Windows 10 about a month ago, and I changed the default location of "Pictures", "Downloads", "Documents", "Audio" and "Video" folder. I changed them so they resided on my 750 Gb storage drive instead of my 120 Gb SSD drive. All was fine. Now, last week after the...

Users found this page by searching for:

  1. [window title]i:\pte.exe[content]i:\pte.exethe file or directory is corrupted and unreadable.[ok]