DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: List of folders to be copied automatically  (Read 8,969 times)

KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
List of folders to be copied automatically
« on: April 02, 2009, 11: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
Re: List of folders to be copied automatically
« Reply #1 on: April 02, 2009, 01:56 PM »
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
Re: List of folders to be copied automatically
« Reply #2 on: April 02, 2009, 01:59 PM »
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
Re: List of folders to be copied automatically
« Reply #3 on: April 03, 2009, 07:48 AM »
Is there really nobody that can help me on this?

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: List of folders to be copied automatically
« Reply #4 on: April 08, 2009, 03:26 PM »
:) Here's a quick AutoHotkey script.

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

Skrommel

Code
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, 03:28 PM by skrommel »

Original address: https://www.donationcoder.com/forum/index.php?topic=17738.0