Move file with different extension


#1

Hello guys,

need help with moving files. Imagine that you have one folder with all inputs. You read everything they include a save them to another folder as .txt file. Then you work with these. txt files meaning that you identifiy the oldest one by
File= new DirectoryInfo(myAllPath).GetFileSystemInfos().OrderByDescending(function(fi) fi.CreationTime).First()

When a condition is met you want to move the file from the first folder to another. So not your file save in variable File.
These files has the same name meaning that
File.Name.Remove(File.Name.LastIndexOf(".")) is the same, but in the first folder the extension could be whatever so I dont know what input should be in the activity MoveFile. Can anyone help me please?


#2

image

try with Directory.GetFiles. PDFRootPath will be your folder contains all files.
if you put condition path.GetExtentions(item)=".pdf" then it will pick up only pdf files and ignore all other extensions.

after this use Move files activity to move your desired file accordingly.
image
Hope my inputs are useful