CTSchmidt 1 Posted September 9, 2014 Report Share Posted September 9, 2014 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 Quote Link to post Share on other sites
arunner26 51 Posted September 9, 2014 Report Share Posted September 9, 2014 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 offfor %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 offfor %I in (C:\\Windows\\System32\\*.exe) do echo.Size of \"%I\" is %~zI bytes"), "Global") Andy 1 Quote Link to post Share on other sites
UBotDev 276 Posted September 9, 2014 Report Share Posted September 9, 2014 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. Quote Link to post Share on other sites
arunner26 51 Posted September 9, 2014 Report Share Posted September 9, 2014 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 Quote Link to post Share on other sites
Marton 48 Posted September 9, 2014 Report Share Posted September 9, 2014 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 Quote Link to post Share on other sites
UBotDev 276 Posted September 9, 2014 Report Share Posted September 9, 2014 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/ 2 Quote Link to post Share on other sites
CTSchmidt 1 Posted September 11, 2014 Author Report Share Posted September 11, 2014 cool stuff, i will try the command line solution Quote Link to post Share on other sites
Denethor 1 Posted April 14, 2017 Report Share Posted April 14, 2017 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. Quote Link to post Share on other sites
Denethor 1 Posted April 14, 2017 Report Share Posted April 14, 2017 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") Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.