Can anyone kind-hearted help checking following post? -- Regarding changing file name and move file

Your contribution will be highly appreciated.:stuck_out_tongue:

Check the following thread -

Karthik Byggari

1 Like

Thanks man for the kindly reply.

I checked link provided but still dont have idea how to get the file that need renamed.
Could you plesae give me more details on how to handle case below?

The oringinal data is like following.
※※※In a word you can regard the first file name as title in each set, get the string between “~_00” and “.txt” and insert it into the place where “a,b,c,d,e,f,g” are.





So, I’m just thinking about some ideas to solve this…
Looks like you could get all files in a folder+subdirectories, which will include all files in your example in one list of filepaths. Then, query it to just the files that have “_00” (also using Regex). You can then loop through each of those filepaths, and pull out the part after the “_00” (again using Regex) to use in the filename of the other files. Also, pull out the first part, for example “20181202_HL00431” (using Regex) and use this to query the list of filepaths again but by all filepaths have equal the first part. With that list, you can simply run them through a loop, using the last part that was pulled out in the rename. The rest of it works itself out.

psuedocode representation might look like this:

fileList = GetFiles(mainDirectory, "*.txt")
ForEach 00file in fileList.Where(Function(f) Regex.Match(GetFilename(f), 00pattern).Success)
    prefix = Regex.Match(GetFilename(00file), prefixPattern).Value
    suffix = Regex.Match(GetFilenameWithoutExtension(00file), suffixPattern).Value

    ForEach file in fileList.Where(Function(f) GetFilename(f).StartsWith(prefix) And Not Regex.Match(GetFilename(f), 00pattern).Success)
        suffix2 = Regex.Match(GetFilenameWithoutExtension(file, suffix2Pattern).Value
        fileNew = file.Replace(suffix2, suffix+suffix2)
        Move File activity // from file to fileNew

If you would like a sample, this will take me a little bit. If I don’t get a sample uploaded today, it is because I got too busy with Holiday stuff :stuck_out_tongue:



Almost forgot that it is the biggest festerval in US, will try as suggested and once I cannot make it would be nice if I could get further help.

At this point, reallllly apreciated it for the kind help so far and Merrrrry Christmas!!!

Check this (11.3 KB)

1 Like

Oh my… it is very kind of you!!!:heart_eyes::rofl:
Thanks man for the patience and will do!!

Thanks again and have a good day!!!

1 Like

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