Dynamo for File Move From One Directory to Another

Hello!

I am working on making a script that moves files from one folder to another if the file name contains certain strings such as .jpg or .png.

This would be helpful in the future to clean up directories of project teams where families are in the wrong folders, etc.

I am able to call to my desktop for example and get a file list… then I want to filter the list but I am not sure of the best filtering approach - by string? by mask? with a custom node?

I am also not sure how the file.move node works and searching through the dynamo forum didn’t return any results related to this. I am concerned it is just going to pick up all files and move them which is not what I am looking to do…

Is it possible to do this with Dynamo or is it better to make a batch file?

I have been reading this post to try and wrap my head around list functions:

http://plevit1.blogspot.com/2015/01/examples-for-all-list-actions-in-dynamo.html

1 Like

Hi Emily,

There is a node called “File.Move” try using that.

I think I have an older version of that package to work with 0.9.1 - I’ll have to update this before I test this.

So I am now running 0.9.2 and I have the following script worked out but I get an error when trying to use the file.move node - any suggestions?

My suggestion will be Python Magic :smile:

1 Like

Cool! I will try this out. :smiley: Thank you!

Hi Emily

If you want something with the visual style of Dynamo but possibly more robust & flexible for this kind of thing, I suggest taking a look at Pentaho http://community.pentaho.com/projects/data-integration/

Most of the ‘nodes’ relate to data transformations, but also includes various file nodes https://help.pentaho.com/Documentation/5.1/0L0/0Y0/0L0/040
It is a fantastic tool if you work with databases and the community edition is free.

Andrew


Hi Emily,
You should be able to do what you are after by appending the name of the file that you want to appear in the destination folder. You are currently giving the newpath a destination directory, but no file name. It’s confusing, becuase the operation is really a “move and name” operation.

4 Likes

Hey Zach, can you show a quick example of this doing multiple files at once? I tried list.combine and it doesn’t seem to work. I also tried feeding the lists directly into file.copy and it tells me it doesn’t take arguements of _array,_array, so I assume it doesn’t accept lists.

I’m trying the File.copy. Here is some sample screenshot.

@Josh_Moore this should work for you.

2 Likes