Jump to content
UBot Underground

Open folders and subfolders + file download and rename automation


Recommended Posts

Hi guys,

 

I am a total newbie and I've just purchased Ubot Studio pro version V5.0.5

 

Here is what i need to do but can't figure out how:

 

I have a access to a url with credentials to access the content (it is not ftp).

So to access the content of the url i use the function "Set Website Credentials" before the "Navigate" function. So far no problem.

 

Once I am on the webpage, there are files and folders. I only need to work with the folders 

 

there are about 130 folders. Each of them has the same name pattern of name (i.e file_name_2013_10_23) and in each folder there are sub-folders. Let's name these sub-folders Category_1 to Category_5. In each sub-folders there are again sub-folders. Let's name these sub-folders Item_1 to Item_6. In each of the Item folders there is a csv file named 1.csv. In every folders with the csv file, the file name is 1.csv.

 

Here is a few example of path:

 

file_name_2013_10_23>Category_1>Item_1>1.csv

file_name_2013_10_23>Category_3>Item_2>1.csv

file_name_2013_08_10>Category_5>Item_3>1.csv

 

How can I automate a bot that would open each folder, sub-folder, sub-sub-folder and download the file in a desktop folder and that would rename each file the following way: file_name_2013_10_23_Category_1_Item_1.csv?

It would be awesome if someone could help me or redirect me to the classes/documentation needed to make this bot.

 

Thanks a lot in advance.

Link to post
Share on other sites

scrape each page for the urls into a list

 

then navigate thru a loop to each page (url) and scrape that page for it's urls.

 

untill u get to the csv files

 

and watch these videos http://www.ubotstudio.com/tutorials

 

Vids 2,3 & 5 in particular

 

TC

Link to post
Share on other sites

Hi Guys,
 

So I've been able to move on but now I am stuck and have a few questions:

1. When I run the script, and look at the content of the %Date list in the debugger, the content always change.. Once I'm going to run it and get 46 results, another time 50 another one 86.. It is never the same. it should give me a result a little over 120.

 

2. When I run the script I get the following error message: 
Script Error

Error: boost::filesystem::rename

 

Source: > Program 1 > loop > if > then > loop > if > then > loop > if > then > rename file

 

All the file that I download have the exact same name so I somehow need to rename them to gather them all in one place and identify their content just by reading name of the file.

3. What should i put in the else as I would like to increment the list item but I can only do this from variable. And if i redo it all with variable instead off list, how do i give a value to a scrapped attribute?

 

please see below the code, thanks in advance for your help,

 

set website credentials("Login""Pwd")
navigate("http://myurl.com/subcategory1/subcategory2/""Wait")
clear list(%Date)
clear list(%Extension)
clear list(%Country)
add list to list(%Date$scrape attribute(<outerhtml=w"<a href=\"subcategory3_*/\">subcategory3_*/</a>">, "href"), "Delete", "Global")
set list position(%Date, 0)
loop($list total(%Date)) {
    navigate("http://myurl.com/subcategory1/subcategory2/{$list item(%Date, 0)}", "Wait")
    if($exists(<outerhtml=w"<a href=\"*/\">*/</a>">)) {
        then {
            add list to list(%Extension, $scrape attribute(<outerhtml=w"<a href=\"*/\">*/</a>">, "href"), "Delete", "Global")
            set list position(%Extension, 0)
            loop($list total(%Extension)) {
                navigate("http://myurl.com/subcategory1/subcategory2/{$list item(%Date, 0)}/{$list item(%Extension, 0)}", "Wait")
                if($exists(<outerhtml=w"<a href=\"*/\">*/</a>">)) {
                    then {
                        add list to list(%Country, $scrape attribute(<outerhtml=w"<a href=\"*/\">*/</a>">, "href"), "Delete", "Global")
                        set list position(%Country, 0)
                        loop($list total(%Country)) {
                            navigate("http://myurl.com/subcategory1/subcategory2/{$list item(%Date, 0)}/{$list item(%Extension, 0)}/{$list item(%Country, 0)}", "Wait")
                            if($exists(<href="1.csv">)) {
                                then {
                                    download file("http://myurl.com/subcategory1/subcategory2/{$list item(%Date, 0)}/{$list item(%Extension, 0)}/{$list item(%Country, 0)}""C:\\Users\\Intern-1\\Desktop\\Ubot Studio\\1.csv")
                                    rename file("C:\\Users\\Intern-1\\Desktop\\Ubot Studio\\1""asd")
                                }
                                else {
                                }
                            }
                        }
                    }
                    else {
                    }
                }
            }
        }
        else {
        }
    }
}

alert($list total(%Extension))                

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