Sign in to follow this  
Followers 0
tes5884

FileFindFirstFile().. Am I doing this right?

6 posts in this topic

The program is supposed to search for *.pst files, then copy the results to a server share.

What am I doing wrong? It doesn't seem to be doing anything.

$nMsg = GUIGetMsg()
Switch $nmsg
Case $bckuppst
While 1
$pst1=FileFindFirstFile("*.pst")
FileCopy($pst1, "\\majordc01\backups\" & @UserName, 8)
$pst2=FileFindNextFile($pst1)
FileCopy($pst2, "\\majordc01\backups\" & @UserName, 8)
if @error then ExitLoop
WEnd
EndSwitch

Thanks!

Share this post


Link to post
Share on other sites



Are the .pst files all in one directory? If so, I would do something simple like this.

$dir1 = @DesktopDir & "Test"
$dir2 = @DesktopDir & "Test2"
FileCopy($dir1 & "*.pst", $dir2)

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Are the .pst files all in one directory? If so, I would do something simple like this.

$dir1 = @DesktopDir & "Test"
$dir2 = @DesktopDir & "Test2"
FileCopy($dir1 & "*.pst", $dir2)

No, I'm trying to search the computer, since some people tend to have pst files laying all over..

Share this post


Link to post
Share on other sites

I did basically copy the help file. Except the help file doesn't give the example I need. Is there some way for me to search recursively, dig deeper into directories? Not just the script directory.

Zedna, thanks for the answer. If you could tell me what I did wrong, would be appreciated.

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  
Followers 0

  • Similar Content

    • KimberlyJillPereira
      By KimberlyJillPereira
      Using the alarm received parameter how to search for the picture that matches the year month day hour min and sec and by the name of the .jpg file the jpg file naming format is first letter is always m followed by last two digits of year then two digit month two digit day two digit hour two digit minute and two digit second then get that picture and paste it in Microsoft Excel.How to do it? Please help me. Thank you.



    • DavidLago
      By DavidLago
      Hello. 
      I need to list only the folders that has a name composed of numbers only.
      How do I do this?
      OBS: I just posted the relevant content to the folder.
      Global $path = "G:\jobs\" For $i = 1 To $aArray[0] Local $search = FileFindFirstFile($path & $aArray[$i] & "\[0-9]" ) I tried with "\*.*" and it returns me the expected result, but the other doesn't.
    • PINTO1927
      By PINTO1927
      Hello guys, I'm working on this script:
      $search = GUICtrlCreateButton("Search", 10, 10, 90, 30) $find = GUICtrlCreateInput("", 710, 10, 200, 25) GUICtrlSetState($find, $GUI_DISABLE) $ok_find = GUICtrlCreateButton("Find", 925, 10, 65, 25) GUICtrlSetState($ok_find, $GUI_DISABLE)  
      Case $search GUICtrlSetState($ok_trova, $GUI_ENABLE) GUICtrlSetState($trova, $GUI_ENABLE) _GUICtrlListView_SimpleSort($list, $g_bSortSense, 0, False) _GUICtrlListView_DeleteAllItems($list) $File_txt = _FileListToArray("\\PATH\", "*.ini", $FLTA_FILES, True) Local $aLines, $File_txt For $i = 1 To $File_txt[0] _FileReadtoArray($File_txt[$i], $aLines) For $j = 1 To $aLines[0] GUICtrlCreateListViewItem($aLines[$j], $list) Next Next For $i2 = 0 To _GUICtrlListView_GetColumnCount($list) _GUICtrlListView_SetColumnWidth($list, $i2, $LVSCW_AUTOSIZE_USEHEADER) Next Case $ok_find $iI = _GUICtrlListView_FindInText($list, GUICtrlRead($input_find)) MsgBox($MB_SYSTEMMODAL, "Information", "Target Item Index: " & $iI) _GUICtrlListView_EnsureVisible($list, $iI) through a inputbox I would search for the desired word and highlight it in the GuiCtrlListView.
      Can you help me?
    • NiceBoy1234
      By NiceBoy1234
      So I tried to get the first file of a folder with FileFindFirstFile but it always gives me a 1 as a value, so it tells me that the folder is empty.
      But the folder is not empty.
      Code:
      Local $path_times_text_01 = "D:\xxx\test\xxx\" Local $search = FileFindFirstFile($path_times_text_01 & "*.*") Timecheck() Func Timecheck() ConsoleWrite($search & @CRLF) If $search = -1 Then MsgBox(0, "Error", "could not find extension") Exit EndIf If $search = 1 Then MsgBox(0, "Fehler", "folder is empty") Exit EndIf ConsoleWrite($search & @CRLF) EndFunc This does not make any sense to make because again the folders are not empty.
    • ViciousXUSMC
      By ViciousXUSMC
      Doing some PC replacements for multi-user computers, one of the problems I run into is Outlook Archives.  Each user may have some hidden away in the default AppData location, others are a bit smarter and put them on a network location.
      I think its time to come up with a script I can run as an admin on the computer that will compile the PST locations of all users to a file for me so I can make sure to not miss those in a PC swap.
      I would most likely enumerate the registry, but it appears there is a COM object that I can perhaps use as well (though not sure if that would be current user only, or can be implemented for an "all user" situation) before I go on the hunt any ideas or already created scripts for this function?