Jump to content
Sign in to follow this  
TuMiM

Copy files by name

Recommended Posts

TuMiM

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

Share this post


Link to post
Share on other sites
Valuater

1 You can not use Opt("GUIOnEventMode",1) and GUIGetMsg(), they will not work in your script

2 What does a line in the listview look like ( the date exactly)

8)


NEWHeader1.png

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.