Jump to content
Sign in to follow this  

FileDelete() not deleting all files

Recommended Posts


I have a loop that runs a dos command and then a fileDelete() to delete the file that was copied to the script dir. It will delete one file but once it loops again it one delete the next.

Heres my code:

For $i = 1 To UBound($bkSrcz)-1 Step 1; Loop to backup user selected files.
            For $o = 1 To UBound ($bkSrcz)-1 Step 1; Loop to copy all files before Compressing
                FileCopy($bkSrcz[$o], @ScriptDir); Get a copy of the file to backup into the scriptdir.
            Next; End the For Loop and continue script.
            FileChangeDir(@ScriptDir); Change our working directory back to @ScriptDir.
            Sleep(1000); Wait 1 second.
            $path = _PathSplit($bkSrcz[$i], $Drive, $Dir, $FName, $Ext); Split the path of $bkSrcz because we moved it to our working directory.
            $path2 = $Fname & $Ext; Set the File name and extension from the split path as $path2
            ProgressSet($progBar * $i, "Compressing... " & $bkSrcz[$i], "Copying User Selected Files"); Advance the Progress Bar
            _RunDOS('7za a -y MbkupBackup.7z "' & $path2 & '"'); Compress selected file(s).
            FileDelete($path2); Delete the copyied file after compressing.
        Next; End the For Loop and continue script.

EDIT: Nevermind, it works after removing the Second For loop

Edited by Mast3rpyr0

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