FileCopy with consistently changing file names

jkpats12

Registered User.
Local time
Today, 17:52
Joined
Jan 27, 2004
Messages
45
Hello,

Was wondering if there was a way to use the FileCopy method when the file name that needs to be copied is different everytime ?

The path is the same but the file that is being sent there has a different name each time and I would like to copy this but unsure how to do this since the file name is always different ?

Any help would be greatly appreciated.

Thank you
 
If the file name in the FROM or TO parameter are in variables, just be sure that the variables contain what you want before you do the file copy.
 
Thanks Doc Man,

Basically the file I receive is coded such as YRT159.txt, and that changes to any combination everyday, tomorrow it could be 782FGY856.txt........I've tried the * wildcard but I get the bad file name or number error.

So I'm still stuck on how I can set it up to read the unique file name ?

Any help is greatly appreciated.

Thanks
 
Try access help on the topic of File System Objects (which involves routines such as GetFolder and the like). You can open a named folder and look through the files in it for a name matching your template. You supply the template before you open the folder. You look at the .FilesFound collection to see what was in the folder.

Or there is always the FileFind (or is it FindFile? I always get that wrong.) Again, give it the wildcard and have it do the search, then look at the .FilesFound collection after you execute the search.
 
Duplicate FileName Problem
when FileCopy occurs, if the filename is already exist I need that message occurs. How it is possible to Check the filename before saving if exist
 
The same concept applies.

Use FileSearch on the file name to see if the .FilesFound.Count is anything other than zero. Look up FileSearch in the Access Help files and in specific look at the examples.
 
Thansk for the help on this Doc Man, I'm all set ....sorry for the delay in responding.
 

Users who are viewing this thread

Back
Top Bottom