Jump to content
Sign in to follow this  
PCI

Search file and copy from network drives

Recommended Posts

PCI

Good afternoon all

I Have issues creating a script to search for files and copy from 3 different drives

1- Need to confirm if Fileexist

Need to select the file that has the proper date ex : group1-filename-20110714.log

Also need to search only selected with the proper groups in the filename ex: group1-filename-20110714.log

2- Network drives have username and Password.

3- Need also to validate that the files were copied successfully to c:\temp into a log file.

here's the part that i'm stuck on it.

$File = FileOpen("c:\temp\groups.txt", 0)
$Lines = _FileCountLines("c:\temp\groups.txt")
$Msg = "You have "&$CountLines&" Members in the Groups.txt"
$todaysdate='@YEAR,@MON,@MDAY'

While 1=1
    $Lines = FileReadLine($File)
    If @error = -1 Then ExitLoop
        MsgBox(0, "Group list ","Copying Member # :"&$Lines)
  $Groups =  StringLeft($Line,6)

IF FileExists('\\Networkdrivepath\folder\'&$groups'-'&$todaysdate'.log'')
THEN
FileCopy ('\\Networkdrivepath\folder\%'&$groups'-'&$todaysdate'.log'',0)

Please help !

Thank you

Share this post


Link to post
Share on other sites
PsaltyDS

This is missing '&' in multiple places, and I don't think you wanted the '%' character or the double single-quotes:

IF FileExists('\\Networkdrivepath\folder\' & $groups & '-' & $todaysdate & '.log') THEN FileCopy ('\\Networkdrivepath\folder\' & $groups & '-' & $todaysdate & '.log', 0)

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×