Jump to content

Search file and copy from network drives


 Share

Recommended Posts

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

Link to comment
Share on other sites

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