Jump to content

FileGetSize returning 0


 Share

Recommended Posts

Could I get some help on why i am getting a return 0 on this? Thank you in advance.

#include <Excel.au3>

#include <Process.au3>

#include <Array.au3>

$sFilePath = @ScriptDir & "Computers.xls"

$oExcel = _ExcelBookOpen ($sFilePath)

$dPath = InputBox("File Path", "Enter File Path Location C$..", "", " M")

$nFile = FileOpen("No File.txt",1)

$fSize = FileOpen("Size Check.txt",1)

$i=1

While $i <= 3

$j=1

Sleep(500) ;reduce cpu usage

$array = _ExcelReadSheetToArray($oExcel) ;read the sheet into an array

$computer = $array[$i][$j]

$fPath = "" & $array & $dPath

$i=$i+1

$size = FileGetSize($fPath)

If $size = 0 then

FileWriteLine ($nFile, $computer)

Else

FileWriteLine($fSize, $size)

EndIf

WEnd

Edited by ThankYou
Link to comment
Share on other sites

I haven't really inspected it to thoroughly but you might try using a full path for the FileGetSize()

but the full path changes base on excel sheet. Does FileGetSize only work with full path? I can't have multiple variables like above? Thank you for your help again

Link to comment
Share on other sites

I haven't really inspected it to thoroughly but you might try using a full path for the FileGetSize()

ah stupid me, sorry for starting a new topic on this. shouldn't have use $array but instead $computer since array was stored in that variable. Thank you for quick reply though

Link to comment
Share on other sites

but the full path changes base on excel sheet. Does FileGetSize only work with full path? I can't have multiple variables like above? Thank you for your help again

actually i think you are missing part of your array.

"$fPath = "" & $array & $dPath"

Should be :

$fPath = "" & $array[0] & $dPath

$fPath = "" & $array[1] & $dPath

or whichever you wanted.

I'm guessing you have an entire spread sheet of file names or something similar?

A true renaissance man

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