Re: Copy files with rename messagebox
From: Al Dunbar [MS-MVP] (alan-no-drub-spam_at_hotmail.com)
Date: 02/08/05
- Next message: Al Dunbar [MS-MVP]: "Re: GUI Scripting applications?"
- Previous message: Al Dunbar [MS-MVP]: "Re: Add Domain User to Local Power Users group."
- In reply to: Dirk Schroeyers: "Copy files with rename messagebox"
- Next in thread: Dirk: "Re: Copy files with rename messagebox"
- Reply: Dirk: "Re: Copy files with rename messagebox"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Feb 2005 20:11:07 -0700
"Dirk Schroeyers" <swiftwegmetdit1977@yahoo.com> wrote in message
news:Xns95F660876B2C1swiftwegmetdit1977ya@195.238.0.34...
> Hello everyone,
>
> I would like to know if it is possible to use an vbscript to move a
> variable amount of files from one location to another and at the same time
> showing a messagebox per moved file, where an user can enter a new name
> under which each file will be saved at their new location. If the user
> tries to give one file the same name as an existing file it would be nice
> if he or she gets an warning.
> This will make sure older files will not be overwritten by newer files
with
> the same name.
> Can this be done?
Yes it can. But if the "variable amount" is a large number, the user will
get pretty tired of having to interactively come up with a different name
for each file as it is presented to him. Perhaps an alternative approach
would be that the new name be calculated from the old name by prefixing it
with something like the current date/time, current user account, or
something along those lines.
Anyway, it is not a MSGBOX you want, but an INPUTBOX; consider the following
pseudocode:
' initialize; determine source and destination locations.
for each file in filecollection
newname = inputbox("enter new name for file: " & file, "file move
utility", file )
move/rename file as newname
next
That may be a bit of an oversimplification. Supposing you wanted to move
file C.txt from C:\A\ to C:\B\ under new name D.txt, and you have already
determined that no file by the name C:\B\D.txt exists. You could rename it
and then move it, but if a file named D.txt already exists in C:\A\, this
would fail. In that event, you could move it first and then rename it, but
that would fail if a file named A.txt already existed in C:\B\. Simplest
solution would be to rename it to a temp name that exists in neither
location, move it, then rename to the desired name.
/Al
- Next message: Al Dunbar [MS-MVP]: "Re: GUI Scripting applications?"
- Previous message: Al Dunbar [MS-MVP]: "Re: Add Domain User to Local Power Users group."
- In reply to: Dirk Schroeyers: "Copy files with rename messagebox"
- Next in thread: Dirk: "Re: Copy files with rename messagebox"
- Reply: Dirk: "Re: Copy files with rename messagebox"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|