473,670 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copying files from 1 folder to other folder??

111 New Member
Hii all,

i have a source folder, i have many .jpg files ..

Now i want all the .jpg files to be copied into new folder...

can anyone plz help me....


How to copy all the files from 1 folder to other folder with renaming the file names that are present in the source folder....????? ?


thnx...
hepsi..
Sep 13 '07 #1
3 1221
vikramadith
12 New Member
Quite simple mate, you ought to have googled it. ;)

Expand|Select|Wrap|Line Numbers
  1. DirectoryInfo dir=new DirectoryInfo(folderPath);
  2. foreach(FileInfo file in dir.GetFiles())
  3.        file.CopyTo(destinationFolder+filename);
If you want only jpg files, you can check the FileInfo.Extens ion before copying.
Sep 13 '07 #2
rhepsi
111 New Member
Quite simple mate, you ought to have googled it. ;)

Expand|Select|Wrap|Line Numbers
  1. DirectoryInfo dir=new DirectoryInfo(folderPath);
  2. foreach(FileInfo file in dir.GetFiles())
  3.        file.CopyTo(destinationFolder+filename);
If you want only jpg files, you can check the FileInfo.Extens ion before copying.

Thnx for ur reply... ive found tht..

Now my requirement is such tht...

I have to rename them...

is there any way out..???

thnx..
hepsi..
Sep 13 '07 #3
vikramadith
12 New Member
Sure, in the code I posted, the 'fileName' variable is something that you can change as you like.
Sep 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1718
by: Terry | last post by:
I am trying to move a datbase from one machine to another. I have tried two different methods and neither are working. First I tried using : >> mysqldump dbName > backup_file.sql >> mysql dbName < backup_file.sql as the manual outlines, but I have a number of foreign keys resulting in errno=150 because the second command above is trying to restore
5
2347
by: TB | last post by:
Hi All: This news group is proving to be great help on my path towards mastering ASP.NET thanks to all of you helpful souls out there. I am looking forward to the day when I can contribute with a few ounces of hard-won knowledge as well. Meanwhile I have this (hopefully small) problem.
10
7827
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in 'to.txt' I specify where to copy it - After I read content of 'to.txt' I create one more subfolder named by current date and thats where everything gets to be copied
4
1403
by: tshad | last post by:
I have an old version of VS 2002 and want to make a copy of my Visual Studio project to another project with another name. In VS 2003, you can do it but there is no copy project command in VS 2002 (at least I can't seem to find it). Is there a way to do it? Thanks, Tom
3
1347
by: Jeries Shahin | last post by:
Hi I am trying to copy files from a folder on a Novel machine, the folder is in the UMC format (i cannot map a network drive for some business reasons). Upon copying, it fires an IOException saying that the file does not exist. Any idea how can I do it? (the user copying is the Novel Administrator)
1
2323
by: Israel | last post by:
I'll preface this by saying that my preference is to dump a database to SQL and transfer that file around but this is not the situation that I'm in and I'll probably be in this situation in future.. I have all of the files from under C:\Program Files\MySQL\MySQL Server 4.1\data that were copied from another machine while mysqld-nt.exe was still running. I thought that maybe I could copy these files over to my machine, after first...
2
8038
by: Jerad Rose | last post by:
I have a fairly simple C# console app which copies files from a network folder to a local folder. When the app resides on my local C: drive, it runs just fine. However, when the app resides on a network drive, copying the same files from the same source drive and to the same destination drive, it gives me the following exception: System.Security.SecurityException: Request for the permission of type...
0
2498
by: AmyHanson | last post by:
I am new to mobile development and am having some trouble sources for the tasks I need to perform. I have been looking around and I can find plenty of information on copying the file initiating on the PC end, I need it to initiate on the Mobile Device end. I need the handheld to be the device that is initiating the file copy as it is the only one that knows the name of the file(s) to be copied. I have found numerous references to using RAPI...
13
10660
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to process the file. The appearance of the command file triggers the device to grab the original file. My problem is I don't want to write the command file to the device until the original file from the workflow has been copied completely. Since these...
0
8471
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6216
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2802
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1795
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.