Jump to content

Copy List of Folders to New Dir


Recommended Posts

I have a list of partial folder names in colB (e.g. "785A5", and the real folder name is "exy-78a5 blah random"). There are about 1500 folders like this. I would like to copy these folders to a new destination. Also, I only keep files in those folders that have a certain prefix, lets call that "indata", and either delete or not copy the other files in that folder.

 

Out of all of that, I really just want to know how to copy folders from one location to another that I have a list of and only partially match.

 

Thanks!

Link to comment
Share on other sites

  • Moderators

timdecker,

Yet another "I know what I mean but you have to guess" thread.

Quote

a list of partial folder names in colB

What is "colB"? How can you access this data?

Quote

"785A5", and the real folder name is "exy-78a5 blah random").

That is not a partial name - unless there is a typo in the full name so what exactly is the relationship? Can you provide a few more examples?

If you can provide the answers to the above, we might be able to offer some help.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Sorry, let me clarify.

 

I have a text file that has the following:

3540
3565
3571
3582
3604
3614

I have folders for each of the following:

C:\folder\exy-3540 kac\
C:\folder\exy-3565 cda\
etc.

I would like to copy the above folders (based on the info in the text file) to another location.

Please let me know if I need to clarify anything else.

Thanks!

Link to comment
Share on other sites

  • Moderators

timdecker,

I would read the text file to an array (_FileReadToArray)  and then read thesub folders within "C:\folder" to another array (_FileListToArray). Now loop though the first array and see if you can find a suitable partial match within the second (_ArraySearch) - when a match is found you create a suitably named folder in the new location. For each folder found use _FileListToArray with a suitable filter to get an array of the "indata" files you require and copy them over to the newly created folder. Finally delete the original folder.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

timdecker,

I am assuming the arrays look as follows:

Partial  Full

3540     C:\folder\exy-3540 kac\
3565     C:\folder\exy-3565 cda\

So you would need to use something like this:

#include <Array.au3>
#include <MsgBoxConstants.au3>

Global $aPartial[3] = [3540, 3565, 3700]
Global $aFull[3] = ["C:\folder\exy-3540 kac\", "C:\folder\exy-3565 cda\", "C:\folder\exy-3800 cda\"]

For $i = 0 To UBound($aPartial) - 1
    $iIndex = _ArraySearch($aFull, $aPartial[$i], 0, 0, 0, 1) ; $iCompare = 1 executes a partial search
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "Error", "No match for: " & $aPartial[$i])
    Else
        MsgBox($MB_SYSTEMMODAL, "Success", "Match for: " & $aPartial[$i] & @CRLF & $aFull[$iIndex])
    EndIf
Next

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

timdecker,

So what did happen?

And why are you not doing as I suggested above? If you create a new folder, list and copy the relevant files and then delete the old folder I am sure you will find that it works correctly - trying to do it all in one go is just asking for trouble.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

timdecker,

Quote

I am having an error on the loop

And what loop would that be? I presume one in your script - which I have not yet seen - so I cannot offer any sensible advice.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...