Jump to content

Copy files by name


Recommended Posts

I need to copy files by file name from a directory tree to a directory tree which i can do but I need the user to be able to pick from a date range (files are named by date and i cannot use the modified or created dates). My problem is how would i get the files copied depending on the date range they chose?

#include <GUIConstants.au3>

#Include <Date.au3>

#include <File.au3>

Opt("GUIOnEventMode",1)

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Playlist Copy", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("Copy Files", 130, 70, 130, 30)

GUICtrlSetOnEvent($Button_1,"Copy")

$Label_2 = GuiCtrlCreateLabel("Please click on the button below to Copy files from today", 50, 35, 300, 25)

$list1= GUICtrlCreateListView ("Files copied", 80, 125, 225, 150)

GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

;--------------- Functions ---------------

Func Copy()

SplashTextOn("File Copying", "Copying Files, Please wait", 250, 35)

$date = _NowDate()

FileDelete("c:" & "\Log\LSTCOPY.txt")

$NowDate=(@MON & @MDAY & stringright(@YEAR, 2) & @LF)

RunWait(@ComSpec & " /c " & 'xcopy E:\Playlist\* & '$NowDate' & .LST "E:\PLAYLIST" /S/E/Y '>c:\Log\LSTCopy.txt',"c:\", @SW_HIDE)

SplashOff()

Dim $fcst1

_FileReadToArray("c:\Log\LSTCopy.txt", $fcst1)

$Text=FileRead("c:\Log\LSTCopy.txt",FileGetSize("c:\LSTCopy.txt"))

_FileWriteLog("c:\Log\LSTCopy.txt", $Text)

;$ip = StringTrimLeft($ip, StringInStr($ip, "["))

;$ip = StringLeft($ip, StringInStr($ip, "]")-1)

For $x = 1 to $fcst1[0]

GUICtrlCreateListViewItem ($fcst1[$x], $list1)

Next

EndFunc

Func OnExit()

Exit

EndFunc

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...