मुख्य सामग्री पर जाएं

Excel में विशिष्ट फ़ाइलों को एक फ़ोल्डर से दूसरे फ़ोल्डर में कैसे ले जाएँ?

लेखक: ज़ियाओयांग अंतिम संशोधित: 2017-08-08

मान लीजिए, मेरे पास एक बड़ा फ़ोल्डर है जिसमें विभिन्न प्रकार की फ़ाइलें हैं, जैसे कि docx, jpg, xlsx, आदि जैसा कि स्क्रीनशॉट में दिखाया गया है। अब, मैं कुछ विशिष्ट फ़ाइल प्रकारों को एक-एक करके मैन्युअल रूप से स्थानांतरित किए बिना फ़ोल्डर से दूसरे नए फ़ोल्डर में ले जाना चाहता हूं। क्या आपके पास एक्सेल में इस कार्य को हल करने के लिए कोई अच्छा विचार है?

VBA कोड के साथ विशिष्ट फ़ाइलों को एक फ़ोल्डर से दूसरे फ़ोल्डर में ले जाएँ


VBA कोड के साथ विशिष्ट फ़ाइलों को एक फ़ोल्डर से दूसरे फ़ोल्डर में ले जाएँ

सभी विशिष्ट प्रकार की फ़ाइलों को एक फ़ोल्डर से दूसरे फ़ोल्डर में जितनी जल्दी चाहें स्थानांतरित करने के लिए, निम्नलिखित वीबीए कोड आपकी मदद कर सकता है, कृपया ऐसा करें:

1. बरक़रार रखना ALT + F11 कुंजी को खोलने के लिए अनुप्रयोगों के लिए माइक्रोसॉफ्ट विज़ुअल बेसिक खिड़की.

2। क्लिक करें सम्मिलित करें > मॉड्यूल, और निम्नलिखित कोड को इसमें पेस्ट करें मॉड्यूल खिड़की।

वीबीए कोड: विशिष्ट प्रकार की फ़ाइलों को एक फ़ोल्डर से दूसरे फ़ोल्डर में ले जाएं:

Sub MoveFiles()
'Updateby Extendoffice
    Dim xFd As FileDialog
    Dim xTFile As String
    Dim xExtArr As Variant
    Dim xExt As Variant
    Dim xSPath As String
    Dim xDPath As String
    Dim xSFile As String
    Dim xCount As Long
    Set xFd = Application.FileDialog(msoFileDialogFolderPicker)
    xFd.Title = "Please select the original folder:"
    If xFd.Show = -1 Then
        xSPath = xFd.SelectedItems(1)
    Else
        Exit Sub
    End If
    If Right(xSPath, 1) <> "\" Then xSPath = xSPath + "\"
    xFd.Title = "Please select the destination folder:"
    If xFd.Show = -1 Then
        xDPath = xFd.SelectedItems(1)
    Else
        Exit Sub
    End If
    If Right(xDPath, 1) <> "\" Then xDPath = xDPath + "\"
    xExtArr = Array("*.xlsx*", "*.jpg")
    For Each xExt In xExtArr
        xTFile = Dir(xSPath & xExt)
        Do While xTFile <> ""
            xSFile = xSPath & xTFile
            FileCopy xSFile, xDPath & xTFile
            Kill xSFile
            xTFile = Dir
            xCount = xCount + 1
        Loop
    Next
    MsgBox "Total number of moved files is: " & xCount, vbInformation, "Kutools for Excel"
End Sub

नोट: उपरोक्त कोड में, "*.xlsx*""* .jpg"स्क्रिप्ट में: xExtArr = ऐरे("*.xlsx*", "*.jpg") वे फ़ाइल प्रकार हैं जिन्हें आप स्थानांतरित करना चाहते हैं, आप उन्हें अन्य में बदल सकते हैं या अपनी आवश्यकता के अनुसार अन्य फ़ाइल प्रकार जोड़ सकते हैं।

3। फिर दबायें F5 इस कोड को चलाने के लिए कुंजी, और एक विंडो आपको उस मूल फ़ोल्डर का चयन करने की याद दिलाने के लिए उभरी जहां से आप फ़ाइलों को स्थानांतरित करना चाहते हैं, स्क्रीनशॉट देखें:

4। तब दबायें OK, और एक अन्य विंडो पॉप अप होती है, कृपया गंतव्य फ़ोल्डर चुनें जहां आप फ़ाइलों को स्थानांतरित करना चाहते हैं, स्क्रीनशॉट देखें:

5। और फिर क्लिक करें OK, एक प्रॉम्प्ट बॉक्स आपको याद दिलाने के लिए पॉप अप होगा कि कितनी फ़ाइलें स्थानांतरित की गई हैं, इसे बंद करें, और आप देख सकते हैं कि विशिष्ट jpg, xlsx फ़ाइलें निर्दिष्ट फ़ोल्डर में स्थानांतरित कर दी गई हैं, स्क्रीनशॉट देखें:

सर्वोत्तम कार्यालय उत्पादकता उपकरण

🤖 कुटूल्स एआई सहयोगी: निम्न के आधार पर डेटा विश्लेषण में क्रांति लाएं: बुद्धिमान निष्पादन   |  कोड जनरेट करें  |  कस्टम फ़ॉर्मूले बनाएं  |  डेटा का विश्लेषण करें और चार्ट बनाएं  |  कुटूल फ़ंक्शंस का आह्वान करें...
लोकप्रिय सुविधाएँ: डुप्लिकेट ढूंढें, हाइलाइट करें या पहचानें   |  रिक्त पंक्तियाँ हटाएँ   |  डेटा खोए बिना कॉलम या सेल को संयोजित करें   |   फॉर्मूला के बिना गोल ...
सुपर लुकअप: एकाधिक मानदंड VLookup    मल्टीपल वैल्यू वीलुकअप  |   अनेक शीटों में VLookup   |   फजी लुकअप ....
उन्नत ड्रॉप-डाउन सूची: शीघ्रता से ड्रॉप डाउन सूची बनाएं   |  आश्रित ड्रॉप डाउन सूची   |  बहु-चयन ड्रॉप डाउन सूची ....
स्तम्भ प्रबंधक: कॉलमों की एक विशिष्ट संख्या जोड़ें  |  कॉलम ले जाएँ  |  छिपे हुए कॉलम की दृश्यता स्थिति टॉगल करें  |  रेंज और कॉलम की तुलना करें ...
फीचर्ड फीचर्स: ग्रिड फोकस   |  डिजाइन देखें   |   बड़ा फॉर्मूला बार    कार्यपुस्तिका एवं शीट प्रबंधक   |  संसाधन लाइब्रेरी (ऑटो टेक्स्ट)   |  खजूर बीनने वाला   |  कार्यपत्रकों को संयोजित करें   |  एन्क्रिप्ट/डिक्रिप्ट सेल    सूची के अनुसार ईमेल भेजें   |  सुपर फ़िल्टर   |   विशेष फ़िल्टर (फ़िल्टर बोल्ड/इटैलिक/स्ट्राइकथ्रू...) ...
शीर्ष 15 टूलसेट12 टेक्स्ट टूल्स (पाठ जोड़ें, अक्षर हटाएँ, ...)   |   50 + चार्ट प्रकार (गैन्ट चार्ट, ...)   |   40+ प्रैक्टिकल सूत्र (जन्मदिन के आधार पर आयु की गणना करें, ...)   |   19 निवेशन टूल्स (QR कोड डालें, पथ से चित्र सम्मिलित करें, ...)   |   12 रूपांतरण टूल्स (शब्दों को संख्याएँ, मुद्रा रूपांतरण, ...)   |   7 विलय और विभाजन टूल्स (उन्नत संयोजन पंक्तियाँ, विभाजन कोशिकाओं, ...)   |   ... और अधिक

एक्सेल के लिए कुटूल के साथ अपने एक्सेल कौशल को सुपरचार्ज करें, और पहले जैसी दक्षता का अनुभव करें। एक्सेल के लिए कुटूल उत्पादकता बढ़ाने और समय बचाने के लिए 300 से अधिक उन्नत सुविधाएँ प्रदान करता है।  वह सुविधा प्राप्त करने के लिए यहां क्लिक करें जिसकी आपको सबसे अधिक आवश्यकता है...

Description


ऑफिस टैब ऑफिस में टैब्ड इंटरफ़ेस लाता है, और आपके काम को बहुत आसान बनाता है

  • Word, Excel, PowerPoint में टैब्ड संपादन और रीडिंग सक्षम करें, प्रकाशक, एक्सेस, विसियो और प्रोजेक्ट।
  • नई विंडो के बजाय एक ही विंडो के नए टैब में एकाधिक दस्तावेज़ खोलें और बनाएं।
  • आपकी उत्पादकता 50% बढ़ जाती है, और आपके लिए हर दिन सैकड़ों माउस क्लिक कम हो जाते हैं!
Comments (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
i get no popups after theselection screen
This comment was minimized by the moderator on the site
Hi,
Code works great for what I am doing. Thank you! How do you have it check if files exist in the destination folder and prompt the user to ask if they want to overwrite the files or save as another file name? I am working with .pdf files saving to the destination folder.
This comment was minimized by the moderator on the site
To move or copy files from a folder to another based on excel list, and destination (path)
on excel list. plz help...
This comment was minimized by the moderator on the site
Hello
To move or copy files from a folder to another based on excel list, the following article may help you!
This comment was minimized by the moderator on the site
Hi,
I need a help. Can we select few files and move them in to a separate folder by list in excel file?
thanks in advance
This comment was minimized by the moderator on the site
thanks a lot for your big help
This comment was minimized by the moderator on the site
Hello, Kumar,
To move or copy files from a folder to another based on excel list, the following article may help you!
https://www.extendoffice.com/documents/excel/4775-move-files-based-on-excel-list.html

Hope it can help you, thank you!
This comment was minimized by the moderator on the site
Can we select destinaton path in excel list on this macro. plz help.
This comment was minimized by the moderator on the site
Thank you very much, this is excellent. Really appreciate your help.
This comment was minimized by the moderator on the site
Hi

Thanks for helpful tip. I have around 5000 files listed on one excel file. I need to search all these files from the entire computer , if file names are matched then copy and paste in another folder
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations