Vpiši se  \/ 
x
or
x
Registracija  \/ 
x

or

Kako kopirati ali premakniti datoteke iz ene mape v drugo na podlagi seznama v Excelu? 

Če imate seznam imen datotek v stolpcu na delovnem listu in datoteke poiščete v mapi v računalniku. Zdaj pa morate te datoteke, katerih imena so navedena na delovnem listu, iz prvotne mape premakniti ali kopirati v drugo, kot je prikazano na spodnji sliki zaslona. Kako lahko to nalogo končate čim hitreje v Excelu?

Kopirajte ali premaknite datoteke iz ene mape v drugo na podlagi seznama v Excelu s kodo VBA


Kopirajte ali premaknite datoteke iz ene mape v drugo na podlagi seznama v Excelu s kodo VBA

Če želite datoteke premakniti iz ene mape v drugo na podlagi seznama imen datotek, vam bo morda v korist naslednja koda VBA, storite tako:

1. Držite tipko Alt + F11 tipke v Excelu in odpre Microsoft Visual Basic za aplikacije okno.

2. Kliknite Vstavi > Moduliin v okno modula prilepite naslednjo kodo VBA.

Koda VBA: premaknite datoteke iz ene mape v drugo na podlagi seznama v Excelu

Sub movefiles()
'Updateby Extendoffice
    Dim xRg As Range, xCell As Range
    Dim xSFileDlg As FileDialog, xDFileDlg As FileDialog
    Dim xSPathStr As Variant, xDPathStr As Variant
    Dim xVal As String
    On Error Resume Next
    Set xRg = Application.InputBox("Please select the file names:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Set xSFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
    xSFileDlg.Title = " Please select the original folder:"
    If xSFileDlg.Show <> -1 Then Exit Sub
    xSPathStr = xSFileDlg.SelectedItems.Item(1) & "\"
    Set xDFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
    xDFileDlg.Title = " Please select the destination folder:"
    If xDFileDlg.Show <> -1 Then Exit Sub
    xDPathStr = xDFileDlg.SelectedItems.Item(1) & "\"
    For Each xCell In xRg
        xVal = xCell.Value
        If TypeName(xVal) = "String" And xVal <> "" Then
            FileCopy xSPathStr & xVal, xDPathStr & xVal
            Kill xSPathStr & xVal
        End If
    Next
End Sub

3. In nato pritisnite F5 tipko za zagon te kode in pojavilo se bo pozivno polje, ki vas bo opozorilo na izbiro celic, ki vsebujejo imena datotek, glejte posnetek zaslona:

4. Nato kliknite OK in v pojavnem oknu izberite mapo, ki vsebuje datoteke, iz katerih se želite premakniti, glejte posnetek zaslona:

5. In nato kliknite OK, nadaljujte z izbiro ciljne mape, kamor želite poiskati datoteke, v drugem izpuščnem oknu, glejte posnetek zaslona:

6. Nazadnje kliknite OK da zaprete okno, in zdaj so bile datoteke premaknjene v drugo mapo, ki ste jo določili na podlagi imen datotek na seznamu delovnih listov, glejte posnetek zaslona:

Opombe: Če želite datoteke samo kopirati v drugo mapo, vendar ohranite izvirne datoteke, uporabite spodnjo kodo VBA:

Koda VBA: Kopirajte datoteke iz ene mape v drugo na podlagi seznama v Excelu

Sub copyfiles()
'Updateby Extendoffice
    Dim xRg As Range, xCell As Range
    Dim xSFileDlg As FileDialog, xDFileDlg As FileDialog
    Dim xSPathStr As Variant, xDPathStr As Variant
    Dim xVal As String
    On Error Resume Next
    Set xRg = Application.InputBox("Please select the file names:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Set xSFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
    xSFileDlg.Title = "Please select the original folder:"
    If xSFileDlg.Show <> -1 Then Exit Sub
    xSPathStr = xSFileDlg.SelectedItems.Item(1) & "\"
    Set xDFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
    xDFileDlg.Title = "Please select the destination folder:"
    If xDFileDlg.Show <> -1 Then Exit Sub
    xDPathStr = xDFileDlg.SelectedItems.Item(1) & "\"
    For Each xCell In xRg
        xVal = xCell.Value
        If TypeName(xVal) = "String" And xVal <> "" Then
            FileCopy xSPathStr & xVal, xDPathStr & xVal
        End If
    Next
End Sub

Najboljša orodja za pisarniško produktivnost

Kutools za Excel rešuje večino vaših težav in poveča produktivnost za 80%

  • Ponovna uporaba: Hitro vstavite zapletene formule, grafikoni in vse, kar ste že uporabljali; Šifriraj celice z geslom; Ustvari poštni seznam in pošiljanje e-pošte ...
  • Vrstica Super Formula (enostavno urejanje več vrstic besedila in formule); Bralna postavitev (enostavno branje in urejanje velikega števila celic); Prilepite v filtrirani obseg...
  • Združi celice / vrstice / stolpce brez izgube podatkov; Vsebina razdeljenih celic; Združi podvojene vrstice / stolpce... prepreči podvojene celice; Primerjaj obsege...
  • Izberite Duplicate ali Unique Vrstice; Izberite prazne vrstice (vse celice so prazne); Super Find in Fuzzy Find v mnogih delovnih zvezkih; Naključna izbira ...
  • Natančna kopija Več celic brez spreminjanja sklica formule; Samodejno ustvarjanje referenc na več listov; Vstavi oznake, Potrditvena polja in še več ...
  • Izvleček besedila, Dodaj besedilo, Odstrani po položaju, Odstrani presledek; Ustvari in natisni vmesne seštevke strani Pretvarjanje med vsebino celic in komentarji...
  • Super filter (shranite in uporabite sheme filtrov za druge liste); Napredno razvrščanje glede na mesec / teden / dan, pogostost in drugo; Poseben filter s krepko, ležeče ...
  • Združite delovne zvezke in delovne liste; Spoji tabele na podlagi ključnih stolpcev; Razdelite podatke na več listov; Paketna pretvorba xls, xlsx in PDF...
  • Več kot 300 zmogljivih funkcij. Podpira Office / Excel 2007-2019 in 365. Podpira vse jezike. Preprosta namestitev v vašem podjetju ali organizaciji. Vse funkcije 30-dnevnega brezplačnega preskusa. 60-dnevno jamstvo za vračilo denarja.
zavihek kte 201905

Kartica Office prinaša vmesnik z zavihki v Office in poenostavi vaše delo

  • Omogočite urejanje in branje z zavihki v Wordu, Excelu, PowerPointu, Publisher, Access, Visio in Project.
  • Odprite in ustvarite več dokumentov v novih zavihkih istega okna in ne v novih oknih.
  • Poveča vašo produktivnost za 50% in vsak dan zmanjša na stotine klikov z miško!
dno pisarniške mize
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Walter · 2 days ago
    Hallo,
    what must i change when i always want to search pdf and jpg files and then copy thes in only one destination folder?
  • To post as a guest, your comment is unpublished.
    Joelle · 21 days ago
    Thank you! you are a life saver!
  • To post as a guest, your comment is unpublished.
    Puneet Goel · 1 months ago
    Thanks a lot.....It really worked very well and solved the issue completely
  • To post as a guest, your comment is unpublished.
    Steve · 2 months ago
    Can anyone help to adapt the code to search specific files in folder and subfolers then copy it to destination?
    • To post as a guest, your comment is unpublished.
      skyyang · 2 months ago
      Hello, Steve,
      To copy the files from one folder including the subfolders to another folder based on the list in sheet, please apply the following code.
      Please try, hope it can help you!
      Sub Copyfiles() 'Updateby Extendoffice Dim xRg As Range, xCell As Range Dim xSFileDlg As FileDialog, xDFileDlg As FileDialog Dim xSPathStr As Variant, xDPathStr As Variant Dim xVal As String Dim fso As Object, folder1 As Object Set xRg = Application.InputBox("Please select the file names:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8) If xRg Is Nothing Then Exit Sub Set xSFileDlg = Application.FileDialog(msoFileDialogFolderPicker) xSFileDlg.Title = " Please select the original folder:" If xSFileDlg.Show <> -1 Then Exit Sub xSPathStr = xSFileDlg.SelectedItems.Item(1) & "\" Set xDFileDlg = Application.FileDialog(msoFileDialogFolderPicker) xDFileDlg.Title = " Please select the destination folder:" If xDFileDlg.Show <> -1 Then Exit Sub xDPathStr = xDFileDlg.SelectedItems.Item(1) & "\" Call sCopyFiles(xRg, xSPathStr, xDPathStr) End Sub Sub sCopyFiles(xRg As Range, xSPathStr As Variant, xDPathStr As Variant) Dim xCell As Range Dim xVal As String Dim xFolder As Object Dim fso As Object Dim xF As Object Dim xStr As String Dim xFS As Object Dim xI As Integer On Error Resume Next If Dir(xDPathStr, vbDirectory) = "" Then MkDir (xDPathStr) End If For xI = 1 To xRg.Count Set xCell = xRg.Item(xI) xVal = xCell.Value If TypeName(xVal) = "String" And Not (xVal = "") Then On Error GoTo E1 If Dir(xSPathStr & xVal, 16) <> Empty Then FileCopy xSPathStr & xVal, xDPathStr & xVal End If End If E1: Next xI On Error Resume Next Set fso = CreateObject("Scripting.FileSystemObject") Set xFS = fso.GetFolder(xSPathStr) For Each xF In xFS.SubFolders xStr = xDPathStr & "\" & xF.Name Call sCopyFiles(xRg, xF.ShortPath & "\", xStr & "\") If (CreateObject("scripting.FileSystemObject").GetFolder(xStr).Files.Count = 0) _ And (CreateObject("scripting.FileSystemObject").GetFolder(xStr).SubFolders.Count = 0) Then RmDir xStr End If Next End Sub

      • To post as a guest, your comment is unpublished.
        HelpMe · 11 days ago
        Can You help me with this? I copied the whole code and it's fine but I'd like to use only part of the file name and not create folder when copyiong file from subfolder. Let's say I have folder AAA with file 123-321.pdf and subfolder BBB with file 123_111.pdf
        In Excel column i have only "123" without any extension or "-" or "_" and I want to copy all files containing "123" from folder AAA to new folder CCC.

        Right now this code would only copy a files when the full name is written in excel column like "123-321.pdf" or would create whole new subfolder BBB in folder CCC if you look for "123_111.pdf"

        Looking forward to Your response as I'm not even a newbie in VBA just passing by :D
  • To post as a guest, your comment is unpublished.
    priya · 2 months ago
    works perfectly like a charm
  • To post as a guest, your comment is unpublished.
    sd · 5 months ago
    can anyone help to adapt this excellent code so the file range is fixed eg all filenames in column A until empty cell and pre set the from path as i always copy from the same source
    • To post as a guest, your comment is unpublished.
      mubashirazizch@gmail.com · 3 months ago
      use this code and keep A1 cell blank

      Sub Copymy1()
      Dim filelist As Variant
      Dim i As Long
      Dim filetocopy As String
      Dim copysource As String
      Dim Copydestination As String

      copysource = "C:\copyfrom\"
      Copydestination = "C:copyto\"
      filelist = ActiveWorkbook.Sheets(1).Range("A1").CurrentRegion.Value
      For i = 2 To UBound(filelist)
      FName = Dir$(copysource & "*.*")
      While FName <> ""
      If UCase(FName) = UCase(filelist(i, 1)) Then
      FileCopy copysource & FName, Copydestination & FName

      End If
      FName = Dir$()
      Wend
      Next i

      End Sub
  • To post as a guest, your comment is unpublished.
    Exe · 6 months ago
    Sorry I just saw the second script below...

    I do have one more (applicable) query... Is there a way to make the script pick a filtered selection on a column? Instead of consecutive cell ranges.. would there be a way to make it pick only some specific rows after a filter is applied?
    THANK YOU
  • To post as a guest, your comment is unpublished.
    Exe · 6 months ago
    Thank you SO MUCH for this. It worked perfectly at my end.
    I have one question... is it possible to modify this to copy the files into the second path instead of moving them? I would need to apply this feature but I do need the source files to remain in the source folders.
    Thank you!!!
  • To post as a guest, your comment is unpublished.
    Phil · 7 months ago
    Hi, Can this code be tweaked to look for partial file names using a wildcard? Thanks
  • To post as a guest, your comment is unpublished.
    sabin348 · 9 months ago
    How could this be adapted to paste into a list of multiple file paths instead of one path at a time?
    • To post as a guest, your comment is unpublished.
      skyyang · 8 months ago
      Hello, sabin,
      Do you want to copy and paste the files which from multiple original folders instead of only one folder?
      • To post as a guest, your comment is unpublished.
        andrea · 7 months ago
        yes please

  • To post as a guest, your comment is unpublished.
    mmarques09 · 11 months ago
    If the reference doesn't exist the code break
    wich line shall I had to the code do a jump through the next reference without stop
  • To post as a guest, your comment is unpublished.
    Marco · 11 months ago
    An what happen if the file doesn't existe in the origin folder?
    the code breaks

    The code shall has a line to jump to another reference if doesn't exist
  • To post as a guest, your comment is unpublished.
    Kevin · 1 years ago
    HI, I am not an expert in VBA but need your Module and I did as you instruct but nothing copied from source folder to the new folder. and no error is shown
  • To post as a guest, your comment is unpublished.
    inasr · 1 years ago
    Any update of how to search on folder and subfolders
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hi, Nasr,
      To move files from folder and subfolders based on cell values, please apply the below VBA code:
      Please try, hope it can help you!

      Sub movefiles()
      'Updateby Extendoffice
      Dim xRg As Range, xCell As Range
      Dim xSFileDlg As FileDialog, xDFileDlg As FileDialog
      Dim xSPathStr As Variant, xDPathStr As Variant
      Dim xVal As String
      Dim fso As Object, folder1 As Object
      ' On Error Resume Next
      Set xRg = Application.InputBox("Please select the file names:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8)
      If xRg Is Nothing Then Exit Sub
      Set xSFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
      xSFileDlg.Title = " Please select the original folder:"
      If xSFileDlg.Show <> -1 Then Exit Sub
      xSPathStr = xSFileDlg.SelectedItems.Item(1) & "\"
      Set xDFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
      xDFileDlg.Title = " Please select the destination folder:"
      If xDFileDlg.Show <> -1 Then Exit Sub
      xDPathStr = xDFileDlg.SelectedItems.Item(1) & "\"
      Call sMoveFiles(xRg, xSPathStr, xDPathStr)
      End Sub

      Sub sMoveFiles(xRg As Range, xSPathStr As Variant, xDPathStr As Variant)
      Dim xCell As Range
      Dim xVal As String
      Dim xFolder As Object
      Dim fso As Object
      Dim xF As Object
      Dim xStr As String
      Dim xFS As Object
      Dim xI As Integer
      On Error Resume Next
      If Dir(xDPathStr, vbDirectory) = "" Then
      MkDir (xDPathStr)
      End If
      For xI = 1 To xRg.Count
      Set xCell = xRg.Item(xI)
      xVal = xCell.Value
      If TypeName(xVal) = "String" And Not (xVal = "") Then
      On Error GoTo E1
      If Dir(xSPathStr & xVal, 16) <> Empty Then
      FileCopy xSPathStr & xVal, xDPathStr & xVal
      Kill xSPathStr & xVal
      End If
      End If
      E1:
      Next xI
      On Error Resume Next
      Set fso = CreateObject("Scripting.FileSystemObject")
      Set xFS = fso.GetFolder(xSPathStr)
      For Each xF In xFS.SubFolders
      xStr = xDPathStr & "\" & xF.Name ' Replace(xF.ShortPath, xSPathStr, xDPathStr)
      Call sMoveFiles(xRg, xF.ShortPath & "\", xStr & "\")
      If (CreateObject("scripting.FileSystemObject").GetFolder(xStr).Files.Count = 0) _
      And (CreateObject("scripting.FileSystemObject").GetFolder(xStr).SubFolders.Count = 0) Then
      RmDir xStr
      End If
      Next
      End Sub
      • To post as a guest, your comment is unpublished.
        inasr · 1 years ago
        That's perfect thank you
        but what about if I just wanted to copy files not moving it from subfolders only without the need of creating subfolders in the destination folder
        ie
        source folder X:\\parent
        inside parent is subfolders test1(file A), test2(file B) and test3(file C)
        then destination folder is "Y:\\destination" has all 3 files A, B, C without the subfolders

        Thank you very much
        • To post as a guest, your comment is unpublished.
          Mike · 1 years ago
          Hi Nasr, did you figure out how to do this? I am looking at a similar need at the moment.

          Copying a selection of files from various subfolders to a single folder
          • To post as a guest, your comment is unpublished.
            inasr · 1 years ago
            Hi Mike
            I kind of did BUT indirectly, so what I did is modify the code to copy the files not move them with the subfolder
            then with CMD file move the file from subfolders to the main folder then delete the empty subfolder
            this is what I did

            Sub Copyfiles()
            'Updateby Extendoffice
            Dim xRg As Range, xCell As Range
            Dim xSFileDlg As FileDialog, xDFileDlg As FileDialog
            Dim xSPathStr As Variant, xDPathStr As Variant
            Dim xVal As String
            Dim fso As Object, folder1 As Object
            ' On Error Resume Next
            Set xRg = Application.InputBox("Please select the file names:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8)
            If xRg Is Nothing Then Exit Sub
            Set xSFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
            xSFileDlg.Title = " Please select the original folder:"
            If xSFileDlg.Show <> -1 Then Exit Sub
            xSPathStr = xSFileDlg.SelectedItems.Item(1) & "\"
            Set xDFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
            xDFileDlg.Title = " Please select the destination folder:"
            If xDFileDlg.Show <> -1 Then Exit Sub
            xDPathStr = xDFileDlg.SelectedItems.Item(1) & "\"
            Call sCopyFiles(xRg, xSPathStr, xDPathStr)
            End Sub

            Sub sCopyFiles(xRg As Range, xSPathStr As Variant, xDPathStr As Variant)
            Dim xCell As Range
            Dim xVal As String
            Dim xFolder As Object
            Dim fso As Object
            Dim xF As Object
            Dim xStr As String
            Dim xFS As Object
            Dim xI As Integer
            On Error Resume Next
            If Dir(xDPathStr, vbDirectory) = "" Then
            MkDir (xDPathStr)
            End If
            For xI = 1 To xRg.Count
            Set xCell = xRg.Item(xI)
            xVal = xCell.Value
            If TypeName(xVal) = "String" And Not (xVal = "") Then
            On Error GoTo E1
            If Dir(xSPathStr & xVal, 16) <> Empty Then
            FileCopy xSPathStr & xVal, xDPathStr & xVal
            End If
            End If
            E1:
            Next xI
            On Error Resume Next
            Set fso = CreateObject("Scripting.FileSystemObject")
            Set xFS = fso.GetFolder(xSPathStr)
            For Each xF In xFS.SubFolders
            xStr = xDPathStr & "\" & xF.Name ' Replace(xF.ShortPath, xSPathStr, xDPathStr)
            Call sCopyFiles(xRg, xF.ShortPath & "\", xStr & "\")
            If (CreateObject("scripting.FileSystemObject").GetFolder(xStr).Files.Count = 0) _
            And (CreateObject("scripting.FileSystemObject").GetFolder(xStr).SubFolders.Count = 0) Then
            RmDir xStr
            End If
            Next
            End Sub



            then copy the following lines to a new notepad then save it as cmd call it whatever

            for /r %%a IN (*.*) do (
            move /y "%%a" "%cd%"
            )
            for /f "delims=" %%d in ('dir /s /b /ad ^| sort /r') do rd "%%d"



            make sure to copy the code as is 4 lines
            hope that help
            • To post as a guest, your comment is unpublished.
              Tim · 1 years ago
              You can achieve the same result using only the VBA if you add a ' before the & "\" & xF.Name in the below line.
              This still copies from subfolders but copies to a single level folder.

              xStr = xDPathStr & "\" & xF.Name ' Replace(xF.ShortPath, xSPathStr, xDPathStr)
              Becomes
              xStr = xDPathStr '& "\" & xF.Name ' Replace(xF.ShortPath, xSPathStr, xDPathStr)
            • To post as a guest, your comment is unpublished.
              inasr · 1 years ago
              make sure to put the cmd file in the same folder that you copy the files and subfolders to then double click it
  • To post as a guest, your comment is unpublished.
    ADOLFO · 1 years ago
    buenas noches, alguien sabe que tengo que modificar para que me mueva carpetas y no solo archivos?
  • To post as a guest, your comment is unpublished.
    jonathan · 1 years ago
    thanks so much !
  • To post as a guest, your comment is unpublished.
    Michael · 1 years ago
    Has anyone figured out how to copy files that are located in multiple subfolders of the main directory, and paste into another folder directory? Also does this transfer method only work for folders on the C drive? I am trying to copy files from our directory that includes multiple subfolders where several files are stored located in Microsoft Sharepoint, to a folder on my C drive.

    Any help would be much appreciated!
  • To post as a guest, your comment is unpublished.
    julien · 1 years ago
    hi do you know how to search also on the subfolder ?
  • To post as a guest, your comment is unpublished.
    technicallyspecific@gmail.com · 1 years ago
    Works great - thank you! However-->>>Can this be adjusted to use a PARTIAL FILE NAME? If so, can you help show how?
    In other words, if file name on the Excel sheet list of filenames is: OW4234TR_J19031.txt (I'd like it to only look at last 5 chars "19031" which is a Julian Date and move a range of files... (anything with a Julian Date of 19092 thru 19120) into the March folder.. The ultimate over-arching task is to locate any files that have Julian dates for March and put those in the Fiscal March Folder "06-Mar" , April into the April folder "07-Apr" and so on...so Fiscal reconciliations by month can then take place.. TIA for any help anyone can offer to expedite this time consuming hunt and picking process. =-)
  • To post as a guest, your comment is unpublished.
    Fer · 1 years ago
    en el codigo que copia ¿como puedo colorear el nombre de la lista que no encuentre?
  • To post as a guest, your comment is unpublished.
    Johnette · 1 years ago
    I cannot get either version to work in Windows 10.


    Argggg
  • To post as a guest, your comment is unpublished.
    Andy · 2 years ago
    Any tips on how to modify the code to add a wide card? I have an archive of hundreds of PDF files that are 10 digit numbers and revision level (XXXXXXXXXX_REVA). I can export a list of file names very easily from our ERP system, but the list is missing the revision and file extension. Is there a way to add wild cards into the program to ignore everything BUT the 10 digit number?
  • To post as a guest, your comment is unpublished.
    PWD · 2 years ago
    Hello,
    how to make this code copy files from subfolders?
  • To post as a guest, your comment is unpublished.
    Gokury · 2 years ago
    Hi Guys,

    How I need to change '' If TypeName(xVal) = "String" And xVal <> "" Then '' to move files based on partial file name.


    Thanks in advance,
    Best regards, P
    • To post as a guest, your comment is unpublished.
      technicallyspecific@gmail.com · 1 years ago
      Did you ever find out HOW to use a PARTIAL FILE NAME? I need that as well...
      In other words, if file name on the Excel sheet list is: OW4234TR_J19031.txt (I'd like it to only look at last 5 chars "19031" which is a Julian Date and move a range of files... anything with a Julian Date of 19031 thru 19075..
      • To post as a guest, your comment is unpublished.
        eric · 1 years ago
        I also would require the partial file name vba modification. Did you ever get a response?
        • To post as a guest, your comment is unpublished.
          Alexandru Matei · 1 months ago
          I am interested in exactly the same solution! Did anyone get the answer?
          I have a P/N list in a column, and I want a piece of code that looks in a parent folder that has several subfolders after files with the name indicated by the list, but only partially, because I don't know the file extension and in many cases for a single P/N in the list, I have several files differentiated by the existence of a suffix that does not always have the same pattern, such as xxxx_1, xxxx_2, xxx (1), xxxx [1], xxxx- (a ), xxxx_ (b) ...., but I need to copy in the destination folder, all the instances of the files that contain in their name the P/N.
          Please help me to not do this job manually for 34078 files that today finds in parent folder and subfolders
  • To post as a guest, your comment is unpublished.
    Sidney · 2 years ago
    Você não tem noção de como me ajudou com esse script... Muito bom!!! Obrigado!!!
  • To post as a guest, your comment is unpublished.
    Robinson · 2 years ago
    Obrigado!!!!
  • To post as a guest, your comment is unpublished.
    Alisson · 2 years ago
    Era exatamente isso que eu precisava!!!

    Muito Obrigado!!!!
  • To post as a guest, your comment is unpublished.
    Raki · 3 years ago
    Hi, In the source folder, I wish to set it as a constant from a cell, for example the path entered in a particular cell, like A1, should be treated as the source folder. How to do this?
  • To post as a guest, your comment is unpublished.
    madhan · 3 years ago
    It is the nice macro.Real helpful for me. but I need some update macro.this used to copy the files from single folder to another folder. we need copy files from folder and subfolder to another folder.