I am in a situation where I have tons of folders and each folders have items that I want to eventually move into one single folder (without having any subfolders). However, I didn’t want to do it manually therefore I tried to use Dynamo script to do it automatically for me.
Thought FileSystem.MoveFile is a simple node and would work easily but its throwing errors that I don’t know what to do lol
I’m trying to move all the files from example folder into example 2 but the error comes out to be;
am I doing something wrong? I currently have only 4 example images in the Example folder to understand the logic. My real work has around 1000+ jpg images.
You’re providing folder/directory paths when the node requires file paths. The two are not interchangeable.
You’ll have to get the files from the directory first. Then you can move them to a new location. Keep in mind a file and a directory are specific object types. A path is just a string. Use the appropriate one for the node.
The nodes below will be helpful. If you’re moving a lot of files at once I’d recommend copying instead of moving in case anything goes wrong.
I believe I connected files to file but telling me that the type of information that was fed in is incorrect… also looked into other forum articles on ‘moving file’ and some of the solutions did the same way as what I did above…
You’re doing a file to file copy, which means you need the full file path in both cases. You get that from the directory contents, but you’re still supplying a singular (folder) path for the destination, which is expecting new file paths. This would be the folder + the file name and extension.
You can get the file name (with extension) from the files you’re copying and append them to your folder location to create new file paths.