Seems very long winded.
if you are making an actual backup in a backup folder, do you even need to rename?
eg You are basically duplicating the contents of Folder A into Folder B
That would do even if not renamed
Instead of filling a listbox, work through the files in Folder A
and for each,
//loop through the files in FolderA
try
Folderb.child(Foldera.child(x).name + ".bak").delete //in case it exists
catch
end try
Foldera.child(x).copyfileto Folderb.child(Foldera.child(x).name + ".bak")
//end loop
Its not the copying thats a problem but if DESTINATION.NAME is changed then it changes the name of the last file I have processed.
i wish to change the DESTINATION.NAME without it doing this.
Have tried many things but seems the is no way to do this,
So if you can come up with a way of me reading a list of file in a folder and folders within that folder as with listfiles and then
pass the folder.nativepath to a routine that processes the file and then saves it under a different folder and name.
amd also altering the file contents so is not just a rename and copy.
As i said I can do it once but then it gores wrong.
if this is not clear please ask.
Thanks for your help and I know that there must be a way to do this
but am not good enough as am getting old and decrepid…
[quote]if DESTINATION.NAME is changed then it changes the name of the last file I have processed.
[/quote]
Dont change it.
Copy original to a new file that has .bak on the end
Thats this:
//loop through the files in FolderA
try
Folderb.child(Foldera.child(x).name + ".bak").delete //in case it exists
catch
end try
Foldera.child(x).copyfileto Folderb.child(Foldera.child(x).name + ".bak")
//end loop
You didnt mention altering the contents at first.
So perhaps:
[code]//loop through the files in FolderA
try
Folderb.child(Foldera.child(x).name + “.bak”).delete //in case it exists
catch
end try
Foldera.child(x).copyfileto Folderb.child(Foldera.child(x).name + “.bak”)
//amend after the copy
Call Alter_contents_of_the_new_file( Folderb.child(Foldera.child(x).name + “.bak”) )
sorry but you lost me with that one.
says x is does not exist and not sure what value it is suppose to have.
I will give short explaination of what i want to achieve.
user sets the source and destination folders
i take each and send it to my routine which alters the file and saves it in the destination folder.(it alters the file)
routine saves using original name + “bak”
it then repeats this for all the files and files in folders in source folder but puts files in destination folder without there original folders they might have been in.