Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 04-18-2020, 10:32 PM
nmkhan3010 nmkhan3010 is offline Folder reorganizing Windows 10 Folder reorganizing Office 2016
Novice
Folder reorganizing
 
Join Date: Feb 2020
Posts: 21
nmkhan3010 is on a distinguished road
Default

Thanks for your prompt response....
Am gaining more productivity with your help....

Currently am doing the same practices but somewhere it is missing and copying wrong files into the folder and again re-checking where it has been missed taking more time and that this is happened due to more no. of files in folder (200+ files) and it is difficult to handle at a time. So am trying for the perfection in this …..

Am having the below code, can you modify according to my need....

Thanks in advance….

Code:
Sub FolderizeFiles()

    Dim fso As Object, fldr As Object, subFldr As Object, fle As Object
    Dim fldrNew As String
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fldr = fso.GetFolder("C:\Users\xuza\test")
        
    For Each fle In fldr.Files
        If Right(fso.GetBaseName(fle), 14) = "-EnglishTables" Then
            fldrNew = fldr.Path & "\" & fso.GetBaseName(fle)
        
            If Not fso.FolderExists(fldrNew) Then
                fso.CreateFolder fldrNew
            End If
            
            fso.MoveFile _
                Source:=fle.Path, _
                Destination:=fldrNew & "\" & fle.Name
        End If
    Next fle
    
    For Each fle In fldr.Files
        For Each subFldr In fldr.SubFolders
            If Left(subFldr.Name, 8) = Left(fle.Name, 8) Then
                fso.MoveFile _
                    Source:=fle.Path, _
                    Destination:=subFldr.Path & "\" & fle.Name
                Exit For
            End If
        Next subFldr
    Next fle

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create rule to move email from archive folder to senders name folder bigduke70 Outlook 0 03-09-2019 08:33 AM
Reorganizing (re-sorting) page numbers PA/EA/Secretary Word 4 03-01-2019 06:43 AM
Hilight Parent Folder when Child folder is allocated a new email brucemc777 Outlook 2 11-09-2016 09:14 AM
Linking to a spreadsheet in the same folder without folder path Jacky837 Excel 0 07-30-2016 05:07 AM
How to constantly and automatically copy the contacts from a shared folder to my private folder? Paulo Outlook 0 08-16-2015 12:06 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft