On Fri, Jul 05, 2019 at 11:37:13AM -0400, The Wanderer wrote: > On 2019-07-05 at 11:32, mick crane wrote: > > after they get made I rename them all in consecutive order and if > > there's other files in there the number order will get messed up. > > Then the obvious solution would seem to be: before even starting, check > whether there are any files in the directory that don't match the naming > pattern you expect - or, even more importantly, any subdirectories - > and, if so, abort with an error message and don't do anything.
Or... keep track of the files you created, and only rename *those* files, not all the files that happen to be in the directory. Or... give your files the correct names in the first place, so you don't have to rename them in a second pass.