473,385 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

getting path

Hi, I have a code to copy/move folders to a specified folder on the
root drive - ie c:\stuff However, I also have the folder "stuff" on
the root of other partitions as well - ie d:\stuff, e:\stuff, etc.
I would like the code to work so that the selected folder for
moving/copying will always go to the "stuff" folder of the drive that
it is on. In other words, if a folder is selected on the d drive, it
will be moved to d:\stuff, if it's on the c: drive, it will be moved
to c:\stuff.
The way the code is now, the path of the destination folder must be
stated specifically in the code.
And the way it works is a browse for folder dialogue comes up to
select the folder to be copied or moved, and after clicking ok, the
move or copy is made, but always to c:\stuff.

any help most appreciated.
tia

gwen
Jul 17 '05 #1
2 5070
> Hi, I have a code to copy/move folders to a specified folder on the
root drive - ie c:\stuff However, I also have the folder "stuff" on
the root of other partitions as well - ie d:\stuff, e:\stuff, etc.
I would like the code to work so that the selected folder for
moving/copying will always go to the "stuff" folder of the drive that
it is on. In other words, if a folder is selected on the d drive, it
will be moved to d:\stuff, if it's on the c: drive, it will be moved
to c:\stuff.
The way the code is now, the path of the destination folder must be
stated specifically in the code.
And the way it works is a browse for folder dialogue comes up to
select the folder to be copied or moved, and after clicking ok, the
move or copy is made, but always to c:\stuff.


Take the 3 left characters from the Folder Path returned by your "Browse for
Folder Dialogue" routine and concatenate the know folder name "stuff" onto
it...

SaveTo = Left$(FolderReturnedByFolderDialog, 3) & "stuff"

Rick - MVP
Jul 17 '05 #2
"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message news:<2J********************@comcast.com>...
Hi, I have a code to copy/move folders to a specified folder on the
root drive - ie c:\stuff However, I also have the folder "stuff" on
the root of other partitions as well - ie d:\stuff, e:\stuff, etc.
I would like the code to work so that the selected folder for
moving/copying will always go to the "stuff" folder of the drive that
it is on. In other words, if a folder is selected on the d drive, it
will be moved to d:\stuff, if it's on the c: drive, it will be moved
to c:\stuff.
The way the code is now, the path of the destination folder must be
stated specifically in the code.
And the way it works is a browse for folder dialogue comes up to
select the folder to be copied or moved, and after clicking ok, the
move or copy is made, but always to c:\stuff.


Take the 3 left characters from the Folder Path returned by your "Browse for
Folder Dialogue" routine and concatenate the know folder name "stuff" onto
it...

SaveTo = Left$(FolderReturnedByFolderDialog, 3) & "stuff"

Rick - MVP

I have a problem along the same lines in a way.
I have common named folders on all drives too ( c:\storage,
d:\storage, and so on) and in each folder there are various other
folders all commonly prefixed and suffixed, like abcProject123,
abcDocs123, and so on.

I am trying to create a button a form that when clicked will bring up
an Input box asking to enter the name of a folder to be retrieved
(moved) from whatever Storage folder it is in. So if user enters Docs
and clicks OK, abcDocs123 is moved and renamed to the root of the same
drive the folder stored on.
In other words, if abcDocs123 was in E:\Storage, it would be moved to
E:\Docs.

Presently, I have the problem partially solved using dos-vbs in a bat
file which can be called by the shell function:

echo fn=InputBox("Enter folder name. ","Folders")>%TEMP%.\FN.VBS
echo wscript.echo "SET FN="&fn>>%TEMP%.\FN.VBS
cscript //nologo %TEMP%.\FN.VBS>%TEMP%.\FN.BAT
CALL %TEMP%.\FN.BAT
for %%a in (c: d: e: f: g: h: i: j: k:) do if exist
"%%a\storage\abc%FN%123\NUL" move "%%a\storage\abc%FN%123" "\%FN%"

What the above does:
brings up an Input box, a folder name is entered, and the folder is
found in whatever drive it is in (c: to k:) The problem is that it
can't move the found folder unless that folder is on the same drive as
the bat file is run from.
So if the bat file is run from the c: drive, only folders found in
c:\storage will be moved to c:\ Move cannot move accross drives but
if VB can make the code so that the found folder will be moved to the
root of whatever drive it is on, then move can always be used and it
would be acceptable and better than using dos-vbs. thanks for any
help!
jenn
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Philip Ronan | last post by:
OK, here's my 2p worth: === Q. Why am I getting the error message 'Headers already sent'? A. PHP produces this error message when you try to set a header for a web page after you have already...
11
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
1
by: Raed Sawalha | last post by:
I have a problem in getting asp.net application physical path in global.ascx static function in my global.ascx i have a static function : first i tried to get the physical path by refelection...
8
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there...
2
by: Praveen | last post by:
Hi All, I have made a webservice in C# and it works fine in my machine. I ran into a crazy problem when I wanted to deploy it in windows 2003 server. I have run "aspnet_regiis.exe -i" to make...
0
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
0
by: sags | last post by:
Hi , Iam a new uesr of this group. I have a small doubt . Iam using the code mentioned below to retrive the data from tab delimited text file ., but Iam getting all the columns of the text file...
32
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
0
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.