topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 16, 2024, 11:08 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: List of folders to be copied automatically  (Read 6872 times)

KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
List of folders to be copied automatically
« on: April 02, 2009, 06:56 AM »
Hi people,

I have in MS Excel a list of folders, some empty, some not, that needs to be copied to another folder, eg s:\temp
The list of files aere in column A of excel, containing a complete path.

Is there a way that I can do this without user interaction?
I also have an Excel sheet with files that needs to be deleted, but I cannot change this in order to work...
Can someone help me on this one?

Thanks in advance!
Koen Franssen

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: List of folders to be copied automatically
« Reply #1 on: April 02, 2009, 08:56 AM »
This is not too difficult to do with a macro (VBA code) right from Excel.  You'd loop thru the list, doing a copy at each pass thru the loop.

KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
Re: List of folders to be copied automatically
« Reply #2 on: April 02, 2009, 08:59 AM »
Yes I know that...
But I am really not good in programming...

The code I use for deleting files is also a makro..
But how do I make a makro that does what I want?


KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
Re: List of folders to be copied automatically
« Reply #3 on: April 03, 2009, 02:48 AM »
Is there really nobody that can help me on this?

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: List of folders to be copied automatically
« Reply #4 on: April 08, 2009, 10:26 AM »
 :) Here's a quick AutoHotkey script.

Change the two first lines of the script. Also, the Excel can only contain one column.

Skrommel

excelfile=Files.xls
target=C:\Target\

#SingleInstance,Force
SendMode,Input
SetTitleMatchMode,2

Run,%excelfile%
WinWait,Excel
WinActivate,Excel
WinWaitActive,Excel
Sleep,1000
Send,^{Home}
Sleep,1000
Send,^+{End}
Sleep,1000
Send,^c
Sleep,1000
StringSplit,file_,Clipboard,`n
WinClose,Excel

Loop,%file_0%
{
  file:=file_%A_Index%
  MsgBox,%file%
  If file<>
    FileMove,%file%,%target%
}
« Last Edit: April 08, 2009, 10:28 AM by skrommel »