Set first image as Folder preview.


  1. Posts : 3
    Windows 7 Ultimate x64
       #1

    Set first image as Folder preview.


    Hi,

    So i want to know if i can set first image of each folder as the preview image.

    example of what i want:
    images in my folder:
    View image: images

    what it shows:
    View image: what it shows

    what i want:
    View image: what i want

    I know i can rename my image as folder.jpg in each folder but i have like 300 folders or even more.

    thanks!
      My Computer


  2. Arc
    Posts : 35,373
    Microsoft Windows 10 Pro Insider Preview 64-bit
       #2

    Possible. if somebody can make a script which will rename all the picture folders first images auto rename to folder.jpg. :)
      My Computer


  3. Posts : 3
    Windows 7 Ultimate x64
    Thread Starter
       #3

    yes, that will be great too
      My Computer


  4. Arc
    Posts : 35,373
    Microsoft Windows 10 Pro Insider Preview 64-bit
       #4
      My Computer


  5. Posts : 640
    Windows 7 Ultimate x64
       #5

    As Arc's link lacked the code to rename the files and I had already got the basics working I thought I would still post my script.

    This poor script I wrote will rename the first file to folder.jpg in all subfolders in the folder it is placed. It will only do it alphabetically (A-Z) regardless of the file sorting you have set, eg. "A" would be renamed. It also does not check if the file is a .jpg but it does check if the file "folder.jpg" already exist.

    Recommend testing on a several subfolders copied to a test folder first. If you want to run it from any location you can put a path and folder name in, just change the bolded text (".\") to your folders path for example, "C:\My Pictures".

    There is also a small safety net in the script, it will ask to confirm you want to run it and require you to type the word "Yes" so you should not be able to accidently run it in the wrong location as is it works on all subfolders in the folder it is placed or all subfolders of the path you put in.

    You DO NOT want to run this on the wrong folder.

    Copy the code to notepad and save as FILENAME.vbs then double click to run it. It will display a message when finished.
    Code:
    strConfirm = InputBox("Are you sure you want to proceed?" & Chr(13) & Chr(13) & "Enter Yes to proceed", _
     "Confirmation", "No")
     
    If strConfirm = "Yes" Then
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        
        objStartFolder = ".\"
        ShowSubFolders objFSO.GetFolder(objStartFolder)
        WScript.echo "Finished"
    Else
        WScript.echo "Cancelled"
    End If
    
    Sub ShowSubFolders(Folder)
        For Each Subfolder in Folder.SubFolders
            Set objFolder = objFSO.GetFolder(Subfolder.Path)
            Set colFiles = objFolder.Files
            
            If Not objFSO.FileExists(objFolder & "\" & "folder.jpg") Then
                For Each objFile in colFiles
                    objFSO.MoveFile objFolder & "\" & objFile.Name, objFolder & "\" & "folder.jpg"
                    Exit For
                Next    
            End If
            
            ShowSubFolders Subfolder
        Next
    End Sub
    Last edited by Duzzy; 20 Jun 2012 at 23:39. Reason: Quoted bolded text in brackets as it is hard to see
      My Computer


  6. Posts : 3
    Windows 7 Ultimate x64
    Thread Starter
       #6

    it worked perfectly thanks !
      My Computer


  7. Posts : 640
    Windows 7 Ultimate x64
       #7

    No problems and good to hear it worked perfectly.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:21.
Find Us