Click here to Skip to main content
15,904,926 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

Excuse me if my question is very basic because I am very new to c# programming.

Long time ago I had a question about "how batch download files from intranet site"

and SAKryukov answered to me with this helpful link

http://www.codeproject.com/Questions/143472/how-to-download-a-file-from-internet.aspx




I copied the code in my console application. Now when I debug that everything is ok

and visual studio 2008 command prompt in Dos comes up with this line:

• "D:\Program Files\Microsoft Visual Studio 9.0\VC>


Before SAKryukov answered to me I have to use this command after compile:


• HttpDownloader url [file name];

Now when I type in front of line in Dos for example:


HttpDownloader http://www.document.com [doc-001]


I have this error "HttpDownloader is not recognized as internal or external command

Please help what is my problem.

Best regards.
Posted

You will have to navigate to the folder that holds the executable file of your console app. Normally when you start up Command Prompt it starts with C:\Users\yourLogonName>. Now if you have compiled you console app int C:\Users\youLogonName\VisualStudio\Projects\HTTPDownLoader, you will need to navigate first to the correct folder.

Hope this helps
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Nov-11 20:39pm    
Hi Wayne,

Thank you very much for helping OP to use my program (I voted 5 for your answer), but this is not the only problem. I clarified it in my answer, please see.

--SA
You have two problems running my program, really elementary ones:

  • Application path is not found. You can either use full path name of HttpDownloaded.exe of change working directory to the directory where this application is located using command cd.
  • The square brackets "[]" is not a part of command line, don't write them. This is traditional notational meta-symbol; it simply means that a file name is optional. If you don't specify file name, a program will generate one out of URL.


Also, a note: there is no such thing as DOS command in newer versions of Windows. This is just a common intepretator CMD.EXE, regular Windows application which you could right yourself.

If you have problems using command line, think about using some more advanced utility providing command like functionality. I personally think using Microsoft Windows Explorer and CMD.EXE a shame (well, I do use CMD.EXE sometimes, but almost never Explorer.EXE). I personally use shareware Total Commander, which is a Orthodox File Manager and it costs me $46 per license and I think this is very good investment for many other reasons as well. I also have my own console utility which provides an interface of text editor to the console.

Enjoy,
—SA
 
Share this answer
 
v2
Comments
masoud_sedighy 20-Nov-11 1:43am    
Thank you very much SAKryukov,excuse me if I am late for answering I run the code like below and it works very well.
E:\sample\ConsoleApplication1\ConsoleApplication1\bin\Debug> consoleApplication1.exe http://www.document.com dw-001

I have another question; actually I do not know exact file names in the web site. I have the list of my documents No like below:
Dw-001
Dw-002
Dw-003
But uploaded files in the server have something more (suffixes) for example like below
Dw-001_rev01.pdf
Dw-002_Rev2_sheet1.pdf
Actually main parts are similar and I know what they are but I do not know suffixes.
Now I like to know can I download my file if I use something like wild card * or % like below
consoleApplication1.exe http://www.document.com dw-001*
Or
consoleApplication1.exe http://www.document.com dw-001%
Or something else. can do that.
Sergey Alexandrovich Kryukov 20-Nov-11 15:37pm    
URLs and file names are not directly related. Web sites have their ways to serve downloading of any resource type for the URL which looks like directory name, such as "http://www.domain.tld/directory/subdirectory/". It does not matter. All you need is the list of URLs and optionally the files you expect to download from each URLs. I hope you know the URLs as they are using in anchors (Wen links) on the same Web site or somewhere else. File name extensions also does not matter, but they give suggestion to the Shell what application should be used to load them. This is not related to downloading.

Look, I want to note: using command line and console-only way of using your system is a key skill for any more or less advanced user, not a software developer. Without it, you cannot say you can fully use your computer without someone's help. You should be able to do everything just on console: using wildcards, relative and absolute file system names, things like '.' and '..', moving/renaming/creating/deleting of files and directories, running application in parallel and not, make basic batch files and more.

--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900