Jump to content
Sign in to follow this  
tes5884

FileFindFirstFile().. Am I doing this right?

Recommended Posts

tes5884

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
JLogan3o13

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
tes5884

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
tes5884

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  

  • Similar Content

    • nacerbaaziz
      By nacerbaaziz
      hello dears
      First I would like to apologize to you for my many questions.
      I have a new question if you allow
      I am programming an audio player for blinds
      I had a problem
      I put an option in the folders context menu to Opens the audio files that in the selected folder
      I did not know how to make the Autoit Search the subfolders
      Please provide an example of how to search for  files in the subfolders
      Let's say, for example, MP3 files
      Just give me a simple example and I will try to modify it as appropriate for the program I designing it
      Please help me to find the solution
      Thanks in advance
    • 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.
×

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.