Jump to content
UBot Underground

checking file size


Recommended Posts

Hi There,

 

is there a way to check the size of a file?

Is it possible to check a whole directory size too? 

 

My bots working for many hours and sometimes one bot get stuck. My Goal is to get a bot wich checks the files if the size has changed. 

 

Maybe there is a Plugin for it? 

 

Thanks in advance

Link to post
Share on other sites

CTSchmidt,

You can use the Advanced Shell free plugin to run a shell command and bring the results into UBOT.

http://www.ubotstudio.com/forum/index.php?/topic/13798-free-plugin-advanced-shell/?hl=advanced%20shell

 

Here are the lines of code from my example bot:

 

set(#FileSize$plugin function("Advanced Shell.dll""$shell batch hidden""echo off

for %I in (C:\\Windows\\System32\\notepad.exe) do echo.Size of \"%I\" is %~zI bytes"), "Global")

set(#FileSizes$plugin function("Advanced Shell.dll""$shell batch hidden""echo off

for %I in (C:\\Windows\\System32\\*.exe) do echo.Size of \"%I\" is %~zI bytes"), "Global")

 

post-15896-0-20112500-1410289945_thumb.jpg

 

 

Andy

  • Like 1
Link to post
Share on other sites

Thanks arunner26 for the example; I just wanted to point him to this URL: http://www.ubotstudio.com/forum/index.php?/topic/14499-solved-get-the-size-of-a-file-in-bytes-mbkb/

 

I've only needed to get file size before we had plugins, so I can't believe there is still no such function (none of the plugins having word "file" in their name also don't have them)... I think this one is calling for a free plugin. :)

Link to post
Share on other sites

UBotDev,

 

You are welcome. It looked like a handy piece of code to have so I wrote the example and remembered that you have the ability to hide the pop up window which is great. Thanks for that!

 

Arunner26

Link to post
Share on other sites

There is already a plugin to get file information (not just size). It's called File/Folder addons (by BotGuru.net), however I bought so many plugins that I don't know whether this one was free or not, so I'm not sure I'm allowed to attach it. I'll ask TJ.

 

set(#file_size$plugin function("FileFolderCommands.dll""$get file info""C:\\test.txt""Total Size"), "Global")

 

Kindest Regards,

Marton

Link to post
Share on other sites

Marton thanks for mentioning it, I forgot about that one...I also thought that I saw it somewhere, but couldn't find it through Google search.

 

Here is the URL for plugin that Marton mentions: http://www.ubotstudio.com/forum/index.php?/topic/13446-sell-plugin-file-folder-manipulation-commands/

  • Like 2
Link to post
Share on other sites
  • 2 years later...

Any way to make this work in Ubot 5.9.44 ?

I assume the free advanced command plugin no longer works, the result is the set variable equals just what I type in for the cmd line to be executed.

Link to post
Share on other sites

The issue might be more in the CMD line in Windows 8+

 

set(#FileSize$plugin function("Advanced Shell.dll""$shell batch hidden""for %I in (C:\\Windows\\System32\\notepad.exe) do @echo.Size of \"%I\" is %~zI bytes"), "Global")

 

​That works, the example given above by arunner26 did not. Had to remove the first "echo off" and add @ to the second echo.

Personally I removed all the text too as I wanted the result to be an integer I could use in my own way, so mine looks like:

 

set(#FileSize,$plugin function("Advanced Shell.dll""$shell batch hidden""for %I in ({#CSVfilename}) do @echo.%~zI"),"Global")
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...