Move File with Dynamic Name

Hello all,

I’m a fairly new user and learning as I go on the program.
I have a sequence set up to download a file and then I would like to move it from the “Downloads” folder to another folder location.
However the tricky bit is that the name will be dynamic:
Summary (18)
Summary (19)
Summary (20)
Summary (21)
Summary (22)
Summary (23)
Summary (24)

I’ve tried to read through the forums but there can’t seem to find anything that solves my problem.

I have read that you can’t use an “*” so I’m not sure what else I can try.
Here is what I have:
image
The above works, but the number 25 will likely change over time.

Any ideas or solutions would be appreciated.

Thanks,
Stephen

Hi @Stephen_B

-First Download All the files at the download location.
-Then use t

he sequence below to move the files to target location.

1 Like

Hello @amarasto,

Thanks for your time and help looking into this one for me.
I’ve run it all bt continue to get this error:
System.IO.IOException: The process cannot access the file because it is being used by another process.

Would you have any idea why that might be?
It can’t be in use as it has just been downloaded.

Thanks again!

First finish the downloading process completely.once the files are downloaded completely then run through the loop.You are getting this error because the file is not downloaded yet.

Thanks @amarasto,

I have tried a delay as below and also above the “Body” but it still doesn’t work.
image
Its also only a 151KB file, so it won’t take more than a second to download.

This is a different issue to my first post, so thanks for helping me fix that one!

1 Like

Is that command trying to move every file in my “download” folder? I only want it to move the file downloaded in the sequence - not every file already in there.

Also, not sure if it is pertinent, but it is csv files I am trying to move.

Thanks again!

Yes,It will move every file available at that location however you can filter the type of files in the method directory.GetFiles() by using an overload of this method which takes filter in the argument.

Directory.GetFiles(“Directory Path”,"*.csv")

The issue you are getting while moving the file may be because of the C directory sometimes UIpath does not allow to access the file from the C drive.

Also there can be another reason which i mentioned earlier file should be completely downloaded to the source location then the sequence for moving the file should go next.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.