File and Folder Automation with StudioX - Organize Your Local Drive

Interesting exercise, I was able to solve it in a similar way as the given solution. One think I did was instead of using a new value for each folder to save whether the folder existed or not I have created 2 general values: FolderName and Folder Exist. I have used the first one to save the name of the current folder to be created (i.e. OnePager, Images, Sorted etc) and then used it as a parameter inside the switch when checking and creating subfolders. In this way I was able to copy and paste all the steps in each Switch option and only ament one parameter to make it work for each switch case:

image

Very good practice, I used Switch. Had a bit of a problem with the Case input as I entered “.png” instead of png as the Project Notebook does not have the “.” infront of the extension. After which it’s running fine.

Have not tried the other approach yet

I agree. Even though this is just a lesson for File and Folder automation, it is not a good habit to teach repetive code, also creates more area for bugs in actual implementation

Nevertheless, the lessons a very helpful. Hope some improvements can be done in the future lessons created

I changed the default case in the switch to handle any other file extensions in the Unsorted folder - a folder labeled Others is created (if it does not exist) and any files that are not .png, .xlsx, .pdf, or .pptx are copied to the Others folder. I agree that delete should be used with caution.

Hi my last run successful but in my Project Folder is empty?

The solution is much more elegant than anything I came up with. When did we cover “Switch”?

I’m seeing more and more of this: demonstration, instructions, and solution do not match. In this example, the instructions do not specifically address *.xlsx files. As a result, mine were deleted. However, in the solution, *.xlsx files are treated just like the others, which makes more sense.

This isn’t a bug, obviously. It’s just a smidge frustrating to see these kinds of disconnects. It makes following along more difficult than it should be.

1 Like

Can someone let me know how to copy a scenario in the switch activity?

Hi:

The same thing happened to me and then in looking at the solution for some advice, I found that in the Move File Activity for each case, there was a back slash after the location, e.g, Project Folder\Sorted\OnePager. I went back and added the back slash to each case and re-ran. All of the files were then stored in the correct folders.

Penny

I had to add the ‘Else’ case to just move the file if the folder exists and it worked.

Hi,
I also encountered a similar problem. After checking, I found it was because of my Move File operation was placed inside the “If”,As a result, the Move File operation is performed only when the corresponding folder does not exist,So it’s only going to copy it once.Move the “Move File” to the outside of the “IF” problem solved.
Cheers
M

Yes, that makes more sense. Thank you.

Agreed - Robot performs as designed/

This one was a little tougher than the others, but i was able to get it. i was excited to see my robot complete the task

I managed to solve this without switches. I honestly didn’t even bother using the Project Workbook as it seemed inefficient to use more memory for a spreadsheet (but I realize I should have for the sake of the exercise…).

What I did instead, was to check the extension of each file and store it in a variable (for later use). Then, I checked if a folder for said file extension existed, and created it accordingly. Finally, I just moved the files to destination_path/[extension], where [extension] was just the variable I stored.

The only problem I can identify with this approach is that the extension folders had the period (.) added at the beginning of their name. While that’s fine on Windows, it could be a problem for someone running on Linux who does not have their file manager set to show hidden files. Linux hidden files and folders start with a period.

I found the workbook thing confusing.

Did I miss a step during the Parker Industries tutorial? Is the robot supposed to create the folder ParkerIndustries Client, or am I supposed to create it? For me it didn’t run properly until I manually created the folder, then it worked.

Great exercise, but a little advice for anyone who want to exercise with this automation, ALWAYS use a working directory and put them inside your project folder to guarantee a more safe exercise

Thanks