+ Reply to Thread
Results 1 to 4 of 4

Moving Files from one directory structure to another directory

  1. #1
    Registered User
    Join Date
    07-16-2013
    Location
    asdf
    MS-Off Ver
    Excel 2007
    Posts
    2

    Moving Files from one directory structure to another directory

    Hello,

    I have a question regarding moving files from one directory to another. I have an excel spreadsheet with a list of file names in Column A. This macro runs through the columns and checks against a directory to see if the file exists, and moves into a destination directory. It runs fine for now, but I was wondering if there was a way to retain the directory structure and create the subfolders within the destination folder.

    Please Login or Register  to view this content.
    Any help is much appreciated!

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Moving Files from one directory structure to another directory

    Quote Originally Posted by harddd View Post
    ... but I was wondering if there was a way to retain the directory structure and create the subfolders within the destination folder.
    It's not clear for me
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    07-16-2013
    Location
    asdf
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Moving Files from one directory structure to another directory

    The problem I have is that the script will find all the files I listed in Column A from the source folder, but it will simply move all files found from all subdirectories to the new destination folder, all in the same root folder. What I would like is for the script to find all the files from the source folder but move them into the destination and create the subdirectories tied to each.

    For example:
    If the source folder is C:\source, then the script will find all files within that directory, including subfolders such as C:\source\sub1 and C:\source\sub2. If there is a file found in C:\source\sub1 and C:\source\sub2, the script will simply move all files found into the destination folder C:\destination. What i want is to retain the structure so that when moved, it will save files into C:\destination\sub1 and C:\desintation\sub2.

    Hope that clarifies a few things.

    Quote Originally Posted by patel45 View Post
    It's not clear for me

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Moving Files from one directory structure to another directory

    try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-16-2013
    Location
    asdf
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Moving Files from one directory structure to another directory

    Thanks for your reply, patel45. However, I believe the code you provided will copy all files from the sourcepath to the destpath. What I originally posted was a script to search for files I listed in Column A and move only those specified files into the destination folder. The problem I really need help with is when it finds the files in the source path to mimic the same directory structure (with subfolders) in the destination path.

    Thanks again.

    Quote Originally Posted by patel45 View Post
    try this
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to Move files from one directory to other directory
    By Shanthuday in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2013, 07:21 AM
  2. [SOLVED] Moving data files from one directory to another
    By ernies111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2012, 12:28 PM
  3. [SOLVED] Excel macro request for Directory Creation & Moving files
    By ganeshinscribe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2012, 10:03 AM
  4. Reading in the files in a directory into an array, directory chosen by user
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-18-2011, 12:52 PM
  5. [SOLVED] moving xls files with macros to another directory?
    By dr chuck in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2006, 03:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1