Page 1 of 1

How to move files from one folder to another

Posted: Mon Oct 05, 2020 8:17 pm
by SteveT
I want to build a flow that move files from one folder and move to another using the first letter in the filename to move to an new folder(A through Z depending on the first letter in the filename). Can anyone help with this?

Re: How to move files from one folder to another

Posted: Mon Oct 05, 2020 8:31 pm
by patej
Hi,
Here you go:
input folder –> set hierarchy path with single line text with variables set to [Job.NameProper:Case="upper",Segment="1,1"] –> Archive hierarchy with one subfolder level.
Image

Re: How to move files from one folder to another

Posted: Mon Oct 05, 2020 9:30 pm
by SteveT
I need Switch to "Look" in an existing folder (this is where the file(s) I want to move reside) and by using the first letter in the filename, MOVE (not copy) that file to a new folder (which is a list of folders from A to Z). So I will need Switch to constantly "look" in the folder and then when a new file appears, to MOVE that file to the appropriate letter folder (A-Z). Note that the file folder are all within the same parent folder.

Re: How to move files from one folder to another

Posted: Mon Oct 05, 2020 9:48 pm
by patej
Hi,
Doesn't my suggestion work? In my screenshot I had an automanaged folder as the input folder, but naturally it would be a user-specified one, i.e. the folder which gets updated with new files over time. And yes, they will be moved, not copied to the output folder in the A..Z folders. Can you clarify what part doesn't work?

Re: How to move files from one folder to another

Posted: Mon Oct 05, 2020 10:07 pm
by SteveT
Yes it worked. Thank you very much! In looking at the individual modules I can't see how it knows to move into the appropriate Letter folder. Where does it say to "move to folder A". Just want to understand where in the Flow it says to do that. Thank you!

Re: How to move files from one folder to another

Posted: Mon Oct 05, 2020 10:25 pm
by patej
I'm glad you got it working :-)

The Set Hierarchy Path element lets you define into what hierarchy (folder structure) the file is stored with the Archive hierarchy element. You can define several levels of hierarchy with it, but your use case required only one, i.e. the first letter folder. This is defined by using the single line text with variables, where the magic lies: [Job.NameProper:Case="upper",Segment="1,1"]:
- Job.NameProper – uses the job (i.e. your file) name without the unique name prefix
- Case="upper" – transforms into upper case (not necessarily required, although depending on the storage system you use, you might end up having both a and A folders, so this ensures all names are in upper case. And it's cleaner looking, too..)
- Segment="1,1" - uses only the first letter of the job name

After you've set the hierarchy path to the job's metadata with that element, Archive hierarchy respects that and creates the necessary folders inside the destination folder so that it can store the file in the correct hierarchy.

––> I recommend you to play around with it a bit to understand it better, e.g. by changing the Segment to 1,3 and see what happens :)

Re: How to move files from one folder to another

Posted: Mon Oct 05, 2020 10:54 pm
by SteveT
Thanks very much. Appreciate your quick response and comprehensive answer!!! It helps more than you know.