File and Folder Automation with StudioX - Organize Your Local Drive

Some of us have that folder on Desktop where all the files go when Desktop gets too crowded. You might have it too!
How would you integrate what you learned in this Milestone about working with files and folders in your automation projects?

For any technical question , please create a new topic in the StudioX category here .

1 Like

This project has some bug and really dangerous behaviour. Be careful!. When you have a folder plenty of different extension file, the robot moves all the known extensions correctly but attention!!, it completely removes from the system the unknown extensions!!. It is supposed to just move the files with the specified extensiones, but magicaly, the project notebook processes all the files and remove the rest!. This is a serious bug!

1 Like

Hi Maria,

The process is configured to delete the files that are not .png, .pptx, .xlsx or .pdf. You can see it in the Default case of the Switch activity.

So, no. The project has no bugs. It’s simply configured to follow that logic.

Regards,
Pedro

1 Like

I’m not using the switch activity and moving file is not working even i follow the step by step process.

1 Like

I used a completely different approach which did seem to work. I didn’t use Switch at all.
I don’t know how visible this image will be. it is only the creation of the sub-folders and the processing of the files. I used the extension of the file name as a check if the folder exists and only had one variable. There may be underlying problems I am not aware of

1 Like

I had some very strange behaviour when trying to do the first exercise of renaming files. The change of name didn’t seem to happen until I moved the files. I used Messages to track behaviour. When I tried to select the Full Name option from the Project Notebook I was given an option of FullFileName_Input. I don’t know if this created problems but I spent a lot of time on trying to figure out how the rename worked (I did google and look at forums) until I decided to just try moving on to the move file, and then the rename seemed to work.

2 Likes

I couldn’t make my automation and the details about file automation were limited so I request to extend in the learning courses.Thank you

1 Like

I treated the problem differently I made switch on the extension and I filled a cell of project_notebook with the name of the directory linked to the file. I can then process the creation of the directory and the movement of the file for all the requested extensions (no duplication). So I only have once the test of the directory extension, its possible creation and the movement of the file :wink:

1 Like

Hi Pedro,
Agreed it’s not a bug, as such, but a safer way for users to test/tinker with this 'bot would be to have the default switch as ‘skip’ rather than ‘delete.’

regards

Rick

1 Like

I did not use a switch but instead “Folder exist” and then a “If” followed by a “Move” or “Create folder + move”.

1 Like

@engrgerald23 move file should work as long as you enter the right variable, in this case we need to use the full path of the current file since it’s inside a loop.

You can see more details of its usage here.

Hope that helps :slight_smile:

1 Like

Everything works! Was able to resolve one issue in the switch and now it works seamlessly.

1 Like

I had a tough time doing this project

1 Like

I faced issue while trying Demo Video as somehow its not working and was not able to figure out exact issue.

1 Like

I did this competely different. It will work in different scenario’s and I think is much more usable in real life.

  • I used the ‘Get folder info’ with ‘ask when run’ so I can input whichever folder I want to sort. I used this value wherever the folder path was needed.
  • I created a table in the notebook scratchpad with the needed folder name (excel, word, …) and and the corresponding extension (.xlsx, .docx)
  • I used the ‘for each row’ activity to check if the folder exists and to create it when necessary
  • I used a second ‘for each row’. In this I embedded ‘for each file in folder’ and the ‘if’ condition where I had the robot check the file extension of the current file with the current row extension name that I specified in the excel notebook and if true had it move the file to the current row name folder.

This allows me to simply add new folders with corresponding extensions in the notebook whenever I need them without needing to alter the robot instructions.

2 Likes

:face_with_monocle::crazy_face: :exploding_head:
the default to delete all not-specified extension in the solution is really dangerous if you were to try it out on your own desktop.

image

3 Likes

I did also similar to that.
From my point of view writing the same sequence again and again for each extension, as it is in the provided solution is not a nice way. The foreach looks more logical, more elegant and much more flexible.

2 Likes

I’m unable to copy all files to the appropriate folders however I’m doing the same steps as suggested by UI Path solution. Seperate folders are successfully done for the different file extensions, but the robot moves ony 1 file for each folders and does nothing with the rest. Any plans what is wrong with the solution?

1 Like

Hi,

Same here. First I thought that my robot is built wrong but checking with the solution I saw that it is exactly the same. I really don’t figure out what is the issue.
But it is very strange that the solution robot works fine…but mine moves only first file for each extension type. I don’t get it.

Cheers
G

2 Likes

This was a bit tricky, but just by following the RobotPath it helped me to finish a project.

1 Like